diff --git a/app/services/protection/verify_pullreq.go b/app/services/protection/verify_pullreq.go index 6a2cac757..24c8d456f 100644 --- a/app/services/protection/verify_pullreq.go +++ b/app/services/protection/verify_pullreq.go @@ -280,7 +280,7 @@ func (v *DefPullReq) MergeVerify( var succeeded bool for i := range in.CheckResults { if in.CheckResults[i].Identifier == requiredIdentifier { - succeeded = in.CheckResults[i].Status == enum.CheckStatusSuccess + succeeded = in.CheckResults[i].Status.IsSuccess() break } } diff --git a/types/enum/check.go b/types/enum/check.go index e6d396115..1c97497dc 100644 --- a/types/enum/check.go +++ b/types/enum/check.go @@ -25,11 +25,12 @@ func GetAllCheckStatuses() ([]CheckStatus, CheckStatus) { return checkStatuses, // CheckStatus enumeration. const ( - CheckStatusPending CheckStatus = "pending" - CheckStatusRunning CheckStatus = "running" - CheckStatusSuccess CheckStatus = "success" - CheckStatusFailure CheckStatus = "failure" - CheckStatusError CheckStatus = "error" + CheckStatusPending CheckStatus = "pending" + CheckStatusRunning CheckStatus = "running" + CheckStatusSuccess CheckStatus = "success" + CheckStatusFailure CheckStatus = "failure" + CheckStatusError CheckStatus = "error" + CheckStatusFailureIgnored CheckStatus = "failure_ignored" ) var checkStatuses = sortEnum([]CheckStatus{ @@ -38,9 +39,13 @@ var checkStatuses = sortEnum([]CheckStatus{ CheckStatusSuccess, CheckStatusFailure, CheckStatusError, + CheckStatusFailureIgnored, }) -var terminalCheckStatuses = []CheckStatus{CheckStatusFailure, CheckStatusSuccess, CheckStatusError} +var terminalCheckStatuses = []CheckStatus{CheckStatusFailure, CheckStatusSuccess, CheckStatusError, + CheckStatusFailureIgnored} + +var successCheckStatuses = []CheckStatus{CheckStatusSuccess, CheckStatusFailureIgnored} // CheckPayloadKind defines status payload type. type CheckPayloadKind string @@ -71,3 +76,7 @@ var checkPayloadTypes = sortEnum([]CheckPayloadKind{ func (s CheckStatus) IsCompleted() bool { return slices.Contains(terminalCheckStatuses, s) } + +func (s CheckStatus) IsSuccess() bool { + return slices.Contains(successCheckStatuses, s) +}