Skip to content

Commit c60a500

Browse files
committed
sync
1 parent 82ad1d3 commit c60a500

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Sync and Merge PHP-SRC
2+
3+
on:
4+
schedule:
5+
# 每天 UTC 时间 00:00 (北京时间 08:00) 自动同步
6+
- cron: '0 0 * * *'
7+
push:
8+
branches: ["my-master"]
9+
workflow_dispatch: # 允许手动触发
10+
11+
jobs:
12+
sync-and-merge:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write # 需要有写入权限才能推送更改
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0 # 获取完整历史记录
22+
23+
- name: Fetch latest master from php/php-src
24+
run: |
25+
git remote add upstream https://github.com/php/php-src.git || true # 如果已存在则忽略
26+
git fetch upstream master
27+
28+
- name: Update local master branch
29+
run: |
30+
git checkout master
31+
git reset --hard upstream/master # 强制同步本地 master 分支
32+
git push origin master --force # 强制推送更新到你的 fork
33+
34+
- name: Merge into my-master
35+
run: |
36+
git checkout my-master
37+
git merge master --no-ff -m "chore: sync with upstream/master $(date +'%Y-%m-%d')"
38+
git push origin my-master
39+
40+
# 后续操作(可选)
41+
- name: Post-merge steps
42+
run: |
43+
echo "合并完成!当前最新提交: $(git rev-parse --short HEAD)"
44+
# 可以在这里添加测试、构建等后续操作

0 commit comments

Comments
 (0)