Skip to content

Commit 073befa

Browse files
authored
add auto fork syncing
1 parent fa25964 commit 073befa

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# .github/workflows/example.yml
2+
3+
name: Merge upstream branches
4+
on:
5+
schedule:
6+
# actually, ~5 minutes is the highest
7+
# effective frequency you will get
8+
- cron: '* * * * *'
9+
jobs:
10+
merge:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Merge upstream
15+
run: |
16+
git config --global user.name 'your-name'
17+
git config --global user.email 'your-username@users.noreply.github.com'
18+
19+
# "git checkout master" is unnecessary, already here by default
20+
git pull --unshallow # this option is very important, you would get
21+
# complains about unrelated histories without it.
22+
# (but actions/checkout@v2 can also be instructed
23+
# to fetch all git depth right from the start)
24+
25+
git remote add upstream https://github.com/example/test.git
26+
git fetch upstream
27+
28+
# Neither forget the -b opt,
29+
# the feature/x ref is ambiguous at this stage
30+
git checkout -b feature/x origin/feature/x
31+
git merge --no-edit upstream/feature/x
32+
git push origin feature/x
33+
34+
git checkout master
35+
git merge --no-edit upstream/master
36+
git push origin master
37+
38+
# etc

0 commit comments

Comments
 (0)