From 13142acf607a2657f79aa0e00b2f037c4548fd7d Mon Sep 17 00:00:00 2001 From: Mathieu Fenniak Date: Wed, 3 Sep 2025 15:04:57 -0600 Subject: [PATCH] fix: refresh Action Log view until entire workflow run is completed --- routers/web/repo/actions/view.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/routers/web/repo/actions/view.go b/routers/web/repo/actions/view.go index b0d9346247..438088a6ac 100644 --- a/routers/web/repo/actions/view.go +++ b/routers/web/repo/actions/view.go @@ -211,10 +211,20 @@ func ViewPost(ctx *context_module.Context) { resp.State.Run.CanApprove = run.NeedApproval && ctx.Repo.CanWrite(unit.TypeActions) resp.State.Run.CanRerun = run.Status.IsDone() && ctx.Repo.CanWrite(unit.TypeActions) resp.State.Run.CanDeleteArtifact = run.Status.IsDone() && ctx.Repo.CanWrite(unit.TypeActions) - resp.State.Run.Done = run.Status.IsDone() resp.State.Run.Jobs = make([]*ViewJob, 0, len(jobs)) // marshal to '[]' instead of 'null' in json resp.State.Run.Status = run.Status.String() + + // It's possible for the run to be marked with a finalized status (eg. failure) because of a single job within the + // run; eg. one job fails, the run fails. But other jobs can still be running. The frontend RepoActionView uses the + // `done` flag to indicate whether to stop querying the run's status -- so even though the run has reached a final + // state, it may not be time to stop polling for updates. + done := run.Status.IsDone() + for _, v := range jobs { + if !v.Status.IsDone() { + // Ah, another job is still running. Keep the frontend polling enabled then. + done = false + } resp.State.Run.Jobs = append(resp.State.Run.Jobs, &ViewJob{ ID: v.ID, Name: v.Name, @@ -223,6 +233,7 @@ func ViewPost(ctx *context_module.Context) { Duration: v.Duration().String(), }) } + resp.State.Run.Done = done pusher := ViewUser{ DisplayName: run.TriggerUser.GetDisplayName(),