Skip to content

Sync With Upstream #309

Sync With Upstream

Sync With Upstream #309

name: Sync With Upstream
on:
schedule:
- cron: "30 1 * * *"
workflow_dispatch: # adding the workflow_dispatch, so it can be triggered manually
jobs:
sync_with_upstream:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: main
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- id: sync
run: |
python scripts/sync_with_upstream.py -d
- name: Set Outputs
id: so
run: |
PREV_REF=$(<rembg-commit-ref)
cd rembg-upstream
CURR_REF=$(<.git/refs/heads/main)
git fetch --tags
PREV_TAG=$(git describe --tags --abbrev=0 $(<../rembg-commit-ref))
CURR_TAG=$(git describe --tags --abbrev=0)
cd ..
echo "$CURR_REF" > rembg-commit-ref
echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
echo "baseRef=$PREV_REF" >> $GITHUB_OUTPUT
echo "headRef=$CURR_REF" >> $GITHUB_OUTPUT
echo "prevTag=$PREV_TAG" >> $GITHUB_OUTPUT
echo "currTag=$CURR_TAG" >> $GITHUB_OUTPUT
- name: Generate Changelog
id: generate_changelog
uses: nblagoev/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
base-ref: ${{ steps.so.outputs.baseRef }}
head-ref: ${{ steps.so.outputs.headRef }}
repository: danielgatis/rembg
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v4
with:
commit-message: '[${{ steps.so.outputs.date }}] Changes Detected in Upstream'
branch: create-pull-request/auto-updates-${{ steps.so.outputs.date }}
delete-branch: true
title: '[${{ steps.so.outputs.date }}] Changes Detected in Upstream'
body: |
## Changes Detected in [`danielgatis/rembg`](https://github.com/danielgatis/rembg)
**Full Changelog**: https://github.com/danielgatis/rembg/compare/${{ steps.so.outputs.prevTag }}...${{ steps.so.outputs.currTag }}
${{steps.generate_changelog.outputs.result}}
reviewers: rnag