Sync Fork with Upstream #31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync Fork with Upstream | |
| on: | |
| schedule: | |
| - cron: '0 3 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Sync with upstream using rebase | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git remote add upstream https://github.com/typpo/textbelt.git 2>/dev/null || true | |
| git fetch upstream | |
| LOCAL=$(git rev-parse HEAD) | |
| REMOTE=$(git rev-parse upstream/master) | |
| if [ "$LOCAL" = "$REMOTE" ]; then | |
| echo "Already up to date" | |
| exit 0 | |
| fi | |
| git rebase upstream/master || { | |
| echo "Rebase failed - manual intervention required" | |
| git rebase --abort | |
| exit 1 | |
| } | |
| git push origin master --force-with-lease |