Skip to content

Commit 0a1f642

Browse files
authored
Add workflow to sync fork with upstream repository
This workflow syncs the fork with the upstream repository every 5 minutes or on manual trigger.
1 parent 959123f commit 0a1f642

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Sync Fork with Upstream
2+
3+
on:
4+
schedule:
5+
- cron: "*/5 * * * *" # every 5 minutes
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
sync:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout fork
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Add upstream remote
22+
run: |
23+
git remote add upstream https://github.com/github/docs.git || true
24+
git remote -v
25+
26+
- name: Fetch upstream
27+
run: git fetch upstream
28+
29+
- name: Merge upstream into fork
30+
run: |
31+
git checkout main
32+
git merge upstream/main --no-edit || echo "Nothing to merge"
33+
34+
- name: Push changes
35+
run: git push origin main

0 commit comments

Comments
 (0)