Sync Fork with Upstream #309
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 0 * * *" # every day at midnight UTC | |
| workflow_dispatch: # manual trigger | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout fork | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Add upstream remote and rebase | |
| run: | | |
| git remote add upstream https://github.com/RozoAI/intent-pay.git | |
| git fetch upstream | |
| # Store current branch name | |
| CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
| # Rebase current branch onto upstream/main | |
| git rebase upstream/main || { | |
| # If rebase fails, abort and create a report | |
| git rebase --abort | |
| echo "::warning::Rebase failed. Manual intervention may be required." | |
| exit 1 | |
| } | |
| - name: Push changes | |
| run: | | |
| # Force push with lease for safety (prevents overwriting others' work) | |
| git push --force-with-lease origin $CURRENT_BRANCH | |
| - name: Report success | |
| if: success() | |
| run: echo "Successfully rebased onto upstream/main and pushed to origin." |