Skip to content

Commit 854980b

Browse files
authored
Create sync.yml
1 parent 19d3d5d commit 854980b

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

.github/workflows/sync.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Sync from Uni-CTR
2+
3+
on:
4+
schedule:
5+
- cron: '0 2 * * *' # 每天凌晨2点(UTC)
6+
workflow_dispatch: # 允许手动触发
7+
8+
jobs:
9+
sync_repo:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
# Step 1: 检出目标仓库
14+
- name: Checkout Destination Repo
15+
uses: actions/checkout@v3
16+
with:
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
fetch-depth: 0
19+
20+
# Step 2: 添加源仓库为远程仓库
21+
- name: Add Source Repo as Remote
22+
run: |
23+
git remote add source https://github.com/archersama/Uni-CTR.git
24+
git fetch source
25+
26+
# Step 3: 同步源仓库内容到目标仓库
27+
- name: Sync from Source to Destination
28+
run: |
29+
git reset --hard source/main # 将目标仓库重置为源仓库的 main 分支内容
30+
git push origin main --force

0 commit comments

Comments
 (0)