Sync with upstream #22
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 with upstream | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 6 * * *' | |
| jobs: | |
| repo-sync: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: repo-sync | |
| id: sync | |
| uses: repo-sync/github-sync@7c8493e95237362ad417495e8512c37e78d25f19 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| source_repo: "https://github.com/supabase/realtime" | |
| source_branch: "main" | |
| destination_branch: "upstream-main" | |
| sync_tags: "" | |
| github_token: ${{ secrets.UNITY_PAT }} | |
| - name: Create Pull Request from console | |
| env: | |
| GH_TOKEN: ${{ secrets.UNITY_PAT }} | |
| run: | | |
| # Check if PR already exists with this title | |
| PR_TITLE="🔄 Sync with upstream changes" | |
| EXISTING_PR=$(gh pr list --base main --state open --json title --jq ".[] | select(.title == \"$PR_TITLE\") | .title") | |
| if [ -n "$EXISTING_PR" ]; then | |
| echo "PR with title '$PR_TITLE' already exists. Skipping PR creation." | |
| else | |
| echo "No existing PR found. Creating new PR..." | |
| # Create PR body | |
| PR_BODY="## Upstream Sync | |
| This PR contains the latest changes from the upstream repository. | |
| **Changes included:** | |
| - Synced from upstream/main | |
| - Auto-generated by upstream sync workflow | |
| **Review checklist:** | |
| - [ ] Review the changes for any breaking changes | |
| - [ ] Check for conflicts with local modifications | |
| - [ ] Verify tests pass (if applicable) | |
| --- | |
| *This PR was automatically created by the upstream sync workflow*" | |
| gh pr create \ | |
| --base main \ | |
| --head upstream-main \ | |
| --title "$PR_TITLE" \ | |
| --body "$PR_BODY" | |
| fi |