0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-04-29 08:01:17 +02:00

Use Combine as the function name to combine commit status as combined status

This commit is contained in:
Lunny Xiao 2025-05-25 17:49:11 -07:00
parent eb9fe87231
commit d77674673a
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
2 changed files with 3 additions and 4 deletions

View File

@ -232,7 +232,7 @@ func CalcCombinedStatusState(statuses []*CommitStatus) commitstatus.CombinedStat
for _, status := range statuses {
states = append(states, status.State)
}
return states.CalcAsCombinedStatusState()
return states.Combine()
}
// CalcCombinedStatus returns combined status struct, the commit statuses should order by id desc
@ -252,7 +252,7 @@ func CalcCombinedStatus(statuses []*CommitStatus) *CombinedStatus {
return &CombinedStatus{
RepoID: statuses[0].RepoID,
SHA: statuses[0].SHA,
State: states.CalcAsCombinedStatusState(),
State: states.Combine(),
TargetURL: targetURL,
}
}

View File

@ -56,8 +56,7 @@ type CommitStatusStates []CommitStatusState //nolint
// > failure if any of the contexts report as error or failure
// > pending if there are no statuses or a context is pending
// > success if the latest status for all contexts is success
func (css CommitStatusStates) CalcAsCombinedStatusState() CombinedStatusState {
func (css CommitStatusStates) Combine() CombinedStatusState {
successCnt := 0
for _, state := range css {
switch {