forked from forgejo/forgejo
Backport #23786 Refactor commit status for Actions jobs (#23786) Highlights: - Treat `StatusSkipped` as `CommitStatusSuccess` instead of `CommitStatusFailure`, so it fixed #23599. - Use the bot user `gitea-actions` instead of the trigger as the creator of commit status. - New format `<run_name> / <job_name> / (<event>)` for the context of commit status to avoid conflicts. - Add descriptions for commit status. - Add the missing calls to `CreateCommitStatus`. - Refactor `CreateCommitStatus` to make it easier to use. Co-authored-by: Jason Song <i@wolfogre.com>
This commit is contained in:
parent
580da8f353
commit
29724f31c5
7 changed files with 74 additions and 71 deletions
|
@ -64,12 +64,7 @@ func stopTasks(ctx context.Context, opts actions_model.FindTaskOptions) error {
|
|||
}
|
||||
}
|
||||
|
||||
for _, job := range jobs {
|
||||
if err := CreateCommitStatus(ctx, job); err != nil {
|
||||
log.Error("Update commit status for job %v failed: %v", job.ID, err)
|
||||
// go on
|
||||
}
|
||||
}
|
||||
CreateCommitStatus(ctx, jobs...)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -96,10 +91,7 @@ func CancelAbandonedJobs(ctx context.Context) error {
|
|||
log.Warn("cancel abandoned job %v: %v", job.ID, err)
|
||||
// go on
|
||||
}
|
||||
if err := CreateCommitStatus(ctx, job); err != nil {
|
||||
log.Error("Update commit status for job %v failed: %v", job.ID, err)
|
||||
// go on
|
||||
}
|
||||
CreateCommitStatus(ctx, job)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue