代码同步不太清楚小伙伴们同步代码方式,有人习惯用 PR,有人喜欢用下图同步的方式。不管哪种方式,都需要手动操作的。如有仓库过多,每个都要同步一遍,想想是多大工作量。懒猪分享了 GitHub 库自动同步脚本,供有需要的小伙伴参考:脚本分享进入要同步的库中,切换至 Actions,点击 New workflow 项:打开新页面后,点击篮字的 set up a workflow yourself:设置文件名 sync.yml「可自定义,不与其它脚本同名即可」将下面的脚本填到输入框中,点击右上方 Com
0 Comments
steps: # Step 1: run a standard checkout action -name:Checkouttargetrepo uses:actions/checkout@v4
# Step 2: run the sync action -name:Syncupstreamchanges id:sync uses:aormsby/Fork-Sync-With-Upstream-action@v3.4 with: upstream_sync_repo:arnidan/nsfw-api upstream_sync_branch:main target_sync_branch:main target_repo_token:${{secrets.GITHUB_TOKEN}}# automatically generated, no need to set
# Set test_mode true to run tests instead of the true action!! test_mode:false
-name:Synccheck if:failure() run:| echo "[Error] 由于上游仓库的 workflow 文件变更,导致 GitHub 自动暂停了本次自动更新,您需要手动 Sync Fork 一次。" echo "[Error] Due to a change in the workflow file of the upstream repository, GitHub has automatically suspended the scheduled automatic update. You need to manually sync your fork." exit 1
4 评论