mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-04 07:33:44 +09:00
enhance(actions): add pending job status and align job statuses with GitHub (#39376)
This commit is contained in:
@@ -556,7 +556,7 @@ func MockActionsRunsJobs(ctx *context.Context) {
|
||||
|
||||
{
|
||||
ID: finalID, Link: jobLink(finalID), JobID: "final", Name: "final",
|
||||
Status: actions_model.StatusBlocked.String(), Duration: "0s",
|
||||
Status: actions_model.StatusPending.String(), Duration: "0s",
|
||||
Needs: []string{"local_caller", "cross_caller"},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -556,7 +556,7 @@ func (data *actionRunListData) processActionRuns(ctx *context.Context) bool {
|
||||
for _, job := range jobs {
|
||||
// A deferred matrix is unresolvable until its needs finish, so the whole per-job block
|
||||
// is skipped: parsing the payload would report a valid workflow as invalid.
|
||||
if job.IsMatrixDeferred || !job.Status.In(actions_model.StatusWaiting, actions_model.StatusBlocked) {
|
||||
if job.IsMatrixDeferred || !job.Status.In(actions_model.StatusWaiting, actions_model.StatusBlocked, actions_model.StatusPending) {
|
||||
continue
|
||||
}
|
||||
if err := actions.ValidateWorkflowContent(job.WorkflowPayload); err != nil {
|
||||
|
||||
@@ -766,14 +766,10 @@ func fillViewRunResponseCurrentJob(ctx *context_module.Context, resp *ViewRespon
|
||||
}
|
||||
}
|
||||
|
||||
// describePendingJobDetail explains why a blocked or waiting job has not started
|
||||
// yet, so the user can tell whether it is waiting on its dependencies or on an
|
||||
// available runner. It returns an empty string when the job is not pending or the
|
||||
// cause can't be determined (the caller keeps the generic status label then).
|
||||
// describePendingJobDetail explains why a pending or waiting job has not started, or returns an empty string when it can't tell
|
||||
func describePendingJobDetail(ctx *context_module.Context, current *actions_model.ActionRunJob, jobs []*actions_model.ActionRunJob) string {
|
||||
switch {
|
||||
case current.Status.IsBlocked():
|
||||
// A blocked job is held back by the jobs listed in its `needs`.
|
||||
case current.Status.IsPending():
|
||||
if pending := pendingNeeds(current, jobs); len(pending) > 0 {
|
||||
return ctx.Locale.TrString("actions.runs.waiting_for_dependent_jobs", strings.Join(pending, ", "))
|
||||
}
|
||||
@@ -852,7 +848,7 @@ func convertToViewModel(ctx context.Context, locale translation.Locale, cursors
|
||||
viewJobs = append(viewJobs, &ViewJobStep{
|
||||
Summary: v.Name,
|
||||
Duration: v.Duration().String(),
|
||||
Status: status.String(),
|
||||
Status: util.Iif(status.IsWaiting(), actions_model.StatusPending, status).String(),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ func TestConvertToViewModelCancellingTaskDoesNotRenderRunningSteps(t *testing.T)
|
||||
{
|
||||
Summary: "Complete job",
|
||||
Duration: "0s",
|
||||
Status: "waiting",
|
||||
Status: "pending",
|
||||
},
|
||||
}
|
||||
assert.Equal(t, expectedViewJobs, viewJobSteps)
|
||||
|
||||
Reference in New Issue
Block a user