Skip to content

Commit bed881a

Browse files
committed
Add upstream sync script
1 parent 0a4613f commit bed881a

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/upsteam-sync.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Sync with upstream
2+
on:
3+
schedule:
4+
- cron: '0 6 * * *' # Run daily at 6 AM UTC
5+
workflow_dispatch: # Allow manual trigger
6+
7+
jobs:
8+
sync:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
token: ${{ secrets.GITHUB_TOKEN }}
15+
16+
- name: Add upstream remote
17+
run: git remote add upstream https://github.com/supabase/realtime
18+
19+
- name: Fetch upstream and origin
20+
run: |
21+
git fetch upstream
22+
git fetch origin
23+
24+
- name: Check for changes
25+
id: check
26+
run: |
27+
# Check if upstream branch exists and compare, otherwise compare with HEAD
28+
if git rev-parse --verify origin/upstream >/dev/null 2>&1; then
29+
if git diff --quiet origin/upstream upstream/main; then
30+
echo "changes=false" >> $GITHUB_OUTPUT
31+
else
32+
echo "changes=true" >> $GITHUB_OUTPUT
33+
fi
34+
else
35+
# First time running, upstream branch doesn't exist yet
36+
echo "changes=true" >> $GITHUB_OUTPUT
37+
fi
38+
39+
- name: Sync if changes exist
40+
if: steps.check.outputs.changes == 'true'
41+
run: |
42+
git checkout -B upstream
43+
git merge upstream/main
44+
git push origin upstream

0 commit comments

Comments
 (0)