Skip to content

Commit 6fb0790

Browse files
committed
ci(sync): 每小时同步上游 dev 到本仓库 main(首页提交历史实时更新)
1 parent 5295fa5 commit 6fb0790

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: OpenCode Sync Upstream
2+
on:
3+
schedule:
4+
- cron: "5 * * * *" # 每小时 :05,错开其他流水线
5+
workflow_dispatch:
6+
permissions:
7+
contents: write
8+
jobs:
9+
sync:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 10
12+
steps:
13+
- uses: actions/checkout@v6
14+
with:
15+
fetch-depth: 0
16+
- name: Merge upstream into main
17+
run: |
18+
set -euo pipefail
19+
git config user.name "yuloop"
20+
git config user.email "yuloop@users.noreply.github.com"
21+
git remote add upstream "https://github.com/anomalyco/opencode.git"
22+
git fetch upstream dev
23+
# 无新提交 → 静默退出(不产生任何 commit)
24+
if git merge-base --is-ancestor upstream/dev HEAD; then
25+
echo "上游无新提交,跳过"
26+
exit 0
27+
fi
28+
# 非 fork、无共享历史:必须 --allow-unrelated-histories
29+
# -X ours:README.md/CHANGELOG.md/.gitignore 等两边都有的根文档冲突时保留汉化仓库版本
30+
# 上游独有文件(packages/、src/ 等源码)作为新增文件正常合入
31+
git merge --no-edit --allow-unrelated-histories -X ours FETCH_HEAD
32+
git push origin main

0 commit comments

Comments
 (0)