Disallow merge when required checked are missing (#29143)
fixes #21892 This PR disallows merging a PR when not all commit status contexts configured in the branch protection are met. Previously, the PR was happy to merge when one commit status was successful and the other contexts weren't reported. Any feedback is welcome, first time Go :-) I'm also not sure if the changes in the template break something else Given the following branch protection:  This was shown before the change:  With the change, it is now shown as this:  --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
0ea8de2d07
commit
a11ccc9fcd
4 changed files with 44 additions and 1 deletions
|
@ -51,6 +51,10 @@ func MergeRequiredContextsCommitStatus(commitStatuses []*git_model.CommitStatus,
|
|||
}
|
||||
}
|
||||
|
||||
if matchedCount != len(requiredContexts) {
|
||||
return structs.CommitStatusPending
|
||||
}
|
||||
|
||||
if matchedCount == 0 {
|
||||
status := git_model.CalcCommitStatus(commitStatuses)
|
||||
if status != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue