Skip to content

Commit 64922bf

Browse files
committed
🐳 chore(sync workflow): 自动从上游同步变更
1 parent 6faded0 commit 64922bf

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Sync upstream
2+
3+
on:
4+
schedule:
5+
- cron: '0 2 * * *' # 每天凌晨2点自动运行
6+
workflow_dispatch: # 支持手动触发
7+
8+
jobs:
9+
sync:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- name: Checkout up-sync branch
15+
uses: actions/checkout@v4
16+
with:
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
fetch-depth: 0
19+
ref: up-sync
20+
21+
- name: Add upstream remote
22+
run: git remote add upstream https://github.com/ddnet/ddnet-maps
23+
24+
- name: Fetch upstream
25+
run: git fetch upstream
26+
27+
- name: Hard reset up-sync to upstream/master
28+
run: |
29+
git reset --hard upstream/master
30+
31+
- name: Push to origin up-sync branch (force)
32+
run: |
33+
git push origin up-sync --force
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)