@@ -8,30 +8,43 @@ permissions:
88 contents : write
99 pull-requests : write
1010
11+ concurrency :
12+ group : sync-main-to-beta
13+ cancel-in-progress : true
14+
1115jobs :
12- sync :
16+ open- sync-pr :
1317 runs-on : ubuntu-latest
1418 steps :
15- - uses : actions/checkout@v4
19+ - name : Checkout (full history)
20+ uses : actions/checkout@v4
1621 with :
1722 fetch-depth : 0
1823
19- - name : Create sync branch
24+ - name : Prepare sync branch from main
2025 run : |
2126 git config user.name "github-actions[bot]"
2227 git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
23- git fetch origin beta
24- git checkout -b chore/sync- main-to-beta origin/ beta
25- # 线性历史优先:尝试 fast-forward 或 rebase
26- git merge --ff-only origin/main || git rebase origin/main
27- git push -u origin chore/sync-main-to-beta
28+ git fetch origin main beta --prune
29+ # 以 main 为基准创建/更新同步分支,避免把 beta 上的额外提交带回去
30+ git switch -C chore/sync-main-to-beta origin/main
31+ # 推送到远端(若已存在则强制更新)
32+ git push -u origin chore/sync-main-to-beta -f
2833
29- - name : Open PR main -> beta
34+ - name : Create or update PR main -> beta
3035 uses : peter-evans/create-pull-request@v6
3136 with :
32- title : ' chore(sync): main -> beta'
33- body : ' Auto sync main into beta after a merge to main.'
37+ title : " chore(sync): main -> beta"
38+ body : |
39+ Auto sync **main** into **beta** after changes on main.
40+ - Source: `main`
41+ - Target: `beta`
42+ - Strategy: branch from `main`, open PR to `beta`
3443 base : beta
3544 branch : chore/sync-main-to-beta
3645 labels : sync, automated
3746 draft : false
47+ # 复用已有 PR(避免重复开新 PR)
48+ update-existing : true
49+ committer : github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
50+ author : github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
0 commit comments