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:
parent
eb9fe87231
commit
d77674673a
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user