From 6f0aef5cef37bed2141a39b74daf8e1f80f9944c Mon Sep 17 00:00:00 2001 From: Haoran Date: Thu, 25 Jun 2026 18:14:22 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E5=AE=9A=E6=97=B6=E6=8A=8A=20fork=20main?= =?UTF-8?q?=20=E5=90=8C=E6=AD=A5=E5=88=B0=E4=B8=8A=E6=B8=B8=20shareAI-lab/?= =?UTF-8?q?main?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 每小时(或手动)将 upstream/main 合并进本 fork 的 main,使其包含上游全部更新。 因 workflow 文件常驻 main、已与上游分叉,故用 merge 而非 fast-forward 的 gh repo sync。 Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/sync-upstream.yml | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/sync-upstream.yml diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml new file mode 100644 index 00000000..0bd1d658 --- /dev/null +++ b/.github/workflows/sync-upstream.yml @@ -0,0 +1,33 @@ +name: Sync fork with upstream + +# 定时把本 fork 的 main 合入上游 shareAI-lab/learn-claude-code 的最新提交。 +# 因为这个 workflow 文件本身就在 main 上,main 与上游已分叉、无法 fast-forward, +# 所以用 merge 而非 gh repo sync。结果:main = 全部上游更新 + 本自动化提交。 +# 自己的改动请始终开新分支,不要直接提交到 main,否则可能与上游产生合并冲突。 + +on: + schedule: + - cron: '0 * * * *' # 每小时一次;想每天一次改成 '0 6 * * *' + workflow_dispatch: # 也可在仓库 Actions 页面手动触发 + +permissions: + contents: write # 合并后需要写权限 push 回 main + +jobs: + sync: + runs-on: ubuntu-latest + steps: + # actions/checkout@v6 —— 与本仓库其它 workflow 用同一 pin + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + with: + ref: main + fetch-depth: 0 # merge 需要完整历史 + + - name: Merge upstream/main into main + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git remote add upstream https://github.com/shareAI-lab/learn-claude-code.git + git fetch upstream main + git merge --no-edit upstream/main + git push origin main