mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-17 04:19:29 +02:00
Backport #29631 by @charles7668 Close #29628 rule ``` Test / Build* Test / Build * Test / Build 2* Test / Build 1* ```  rule2 ``` Test / Build* Test / Build 1* ```  rule3 ``` Test / Build* Test / Build 1* NotExist* ```  Co-authored-by: charles <30816317+charles7668@users.noreply.github.com> Co-authored-by: Zettat123 <zettat123@gmail.com> (cherry picked from commit 76b6754c3a42e6f1d675fe9f9d66a65954cb85d1)
This commit is contained in:
parent
43df4755a3
commit
bd0978ce72
2 changed files with 76 additions and 3 deletions
|
@ -34,9 +34,9 @@ func MergeRequiredContextsCommitStatus(commitStatuses []*git_model.CommitStatus,
|
|||
}
|
||||
}
|
||||
|
||||
for _, commitStatus := range commitStatuses {
|
||||
for _, gp := range requiredContextsGlob {
|
||||
var targetStatus structs.CommitStatusState
|
||||
for _, gp := range requiredContextsGlob {
|
||||
for _, commitStatus := range commitStatuses {
|
||||
if gp.Match(commitStatus.Context) {
|
||||
targetStatus = commitStatus.State
|
||||
matchedCount++
|
||||
|
@ -44,7 +44,15 @@ func MergeRequiredContextsCommitStatus(commitStatuses []*git_model.CommitStatus,
|
|||
}
|
||||
}
|
||||
|
||||
if targetStatus != "" && targetStatus.NoBetterThan(returnedStatus) {
|
||||
// If required rule not match any action, then it is pending
|
||||
if targetStatus == "" {
|
||||
if structs.CommitStatusPending.NoBetterThan(returnedStatus) {
|
||||
returnedStatus = structs.CommitStatusPending
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
if targetStatus.NoBetterThan(returnedStatus) {
|
||||
returnedStatus = targetStatus
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue