我们确实有一个提交钩子来强制执行遵循配置约定的消息:
包.json
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-commit": "yarn format:check",
"pre-push": "yarn run test"
}
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
],
"rules": {
"scope-case": [
0,
"always",
"pascal-case"
]
}
},
Run Code Online (Sandbox Code Playgroud)
但是,如果我将 PR 与挤压策略合并(通过 github Web ui),则可能会隐藏提交消息,因为此处未强制执行该策略:
feat: [TICKET-209] add completion tests
Added build instructions to README.md <-- Added via squash
feat: [TICKET-208] improve tests
Run Code Online (Sandbox Code Playgroud)
GitHub 历史记录的这一部分是通过挤压添加第二行的结果,因此没有被检查/拒绝。
有没有解决方案可以拒绝通过 github Web ui 上的挤压添加的无效提交消息?
小智 3
如果您的首要任务是确保没有提交以正确的格式进入主分支,那么“合并队列 + Github 操作以检查提交消息”可能会解决此问题:https ://docs.github.com/en/repositories/configuring- Branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue(注意此功能处于公共测试版)
| 归档时间: |
|
| 查看次数: |
1427 次 |
| 最近记录: |