0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-07-21 12:24:38 +02:00
This commit is contained in:
NorthRealm 2025-07-10 02:12:07 +08:00
parent 2fa624a32e
commit 0a92da5719

View File

@ -55,8 +55,13 @@ func sendActionsWorkflowRunStatusEmail(ctx context.Context, repo *repo_model.Rep
}
sort.SliceStable(jobs, func(i, j int) bool {
si, sj := jobs[i].Status, jobs[j].Status
if si != sj || sj.IsSuccess() /* if not equal, then success is the max */ {
return true
/*
If both i and j are/are not success, leave it to si < sj.
If i is success and j is not, since the desired is j goes "smaller" and i goes "bigger", this func should return false.
If j is success and i is not, since the desired is i goes "smaller" and j goes "bigger", this func should return true.
*/
if si.IsSuccess() != sj.IsSuccess() {
return !si.IsSuccess()
}
return si < sj
})