本页导航
article
github action同步上游仓库
AI摘要
该文章介绍了如何通过GitHub Actions实现上游仓库的自动同步。主要步骤包括:在Actions页面新建工作流并粘贴同步代码,提交保存后即可使用。此后需要同步时,只需在Actions页面点击Run workflow手动触发,无需本地操作,简化了仓库同步流程。
1、点 Actions → New workflow → set up a workflow yourself
2、粘贴以下内容
name: Sync Upstream
on:
workflow_dispatch: # 手动触发
schedule:
- cron: '0 0 * * 0' # 每周日自动同步(可选)
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Add upstream and merge
# 换成你要同步的上游仓库
run: |
git remote add upstream https://github.com/liyao52033668/cloudreve-eo
git fetch upstream
git checkout main
git merge upstream/master
git push origin main
3、点 Commit changes 保存
4、以后需要同步时,去 Actions 页面点 Run workflow → 立即执行,无需本地操作
