Skip to content

Commit 5cf323e

Browse files
Add GitHub Actions workflow for auto-syncing upstream
1 parent 2d86821 commit 5cf323e

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

.github/workflows/auto-sync.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Auto Sync with Upstream
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *' # daily
6+
workflow_dispatch: # allow manual trigger
7+
8+
jobs:
9+
sync:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Set up git user
17+
run: |
18+
git config --global user.name 'github-actions[bot]'
19+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
20+
21+
- name: Add upstream remote and fetch
22+
run: |
23+
git remote add upstream https://github.com/upstream_owner/upstream_repo.git
24+
git fetch upstream
25+
26+
- name: Merge upstream changes
27+
run: |
28+
git checkout master
29+
git merge upstream/master
30+
31+
- name: Push changes
32+
env:
33+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
run: |
35+
git push origin master

0 commit comments

Comments
 (0)