mirror of
https://github.com/shareAI-lab/learn-claude-code.git
synced 2026-08-26 00:32:06 +00:00
每小时(或手动)将 upstream/main 合并进本 fork 的 main,使其包含上游全部更新。 因 workflow 文件常驻 main、已与上游分叉,故用 merge 而非 fast-forward 的 gh repo sync。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
33 lines
1.3 KiB
YAML
33 lines
1.3 KiB
YAML
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
|