Sil*_*aze 13 github github-actions
我正在尝试使用 GitHub Actions 在构建工件时自动增加项目的版本,并将新更改签回主分支。
工作流程使用仅用于此目的的帐户的 PAT 推送提交,因此我能够将该用户从需要主分支 PR 的分支保护规则中排除。
因为该分支还需要进行状态检查,所以推送失败并显示
remote: error: GH006: Protected branch update failed for refs/heads/main.
remote: error: Required status check "build / tests" is expected.
Run Code Online (Sandbox Code Playgroud)
如何让版本提交跳过此检查,同时对所有其他提交强制执行此检查?
小智 0
几天前我遇到了同样的问题。如果您standard-version
在中使用 then ,package.json
您可以执行以下操作:
"standard-version": {
"releaseCommitMessageFormat": "chore(release): {{currentTag}}\n[ci skip]",
},
Run Code Online (Sandbox Code Playgroud)
在 Github 工作流程中,build / tests
您可以添加一个条件来跳过测试,以防推送被标记为[ci skip]
如下:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
Run Code Online (Sandbox Code Playgroud)