Skip to content

Commit 940e583

Browse files
committed
Add auto-sync workflow
1 parent 8ec59f7 commit 940e583

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Auto Sync from Upstream
2+
on:
3+
schedule:
4+
- cron: '0 0 * * *'
5+
workflow_dispatch:
6+
jobs:
7+
sync:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- run: |
12+
git config user.name "Bot" && git config user.email "bot@github.com"
13+
PARENT=$(gh api repos/${{ github.repository }} --jq '.parent.full_name')
14+
[ -n "$PARENT" ] && git remote add upstream "https://github.com/${PARENT}.git"
15+
git fetch upstream
16+
git merge upstream/main --no-edit || git merge upstream/master --no-edit
17+
git push origin HEAD || exit 0

0 commit comments

Comments
 (0)