mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 03:18:24 +00: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>
This commit is contained in:
		| @@ -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,16 +44,20 @@ 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 | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if matchedCount != len(requiredContexts) { | ||||
| 		return structs.CommitStatusPending | ||||
| 	} | ||||
|  | ||||
| 	if matchedCount == 0 { | ||||
| 		status := git_model.CalcCommitStatus(commitStatuses) | ||||
| 		if status != nil { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user