Skip to content

Commit 6b42ea1

Browse files
authored
Rerun job only when run is done (#34970)
For consistency, limit rerunning Job(s) to only when Run is in Done status.
1 parent 95a935a commit 6b42ea1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

routers/web/repo/actions/view.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ func ViewPost(ctx *context_module.Context) {
249249
ID: v.ID,
250250
Name: v.Name,
251251
Status: v.Status.String(),
252-
CanRerun: v.Status.IsDone() && ctx.Repo.CanWrite(unit.TypeActions),
252+
CanRerun: resp.State.Run.CanRerun,
253253
Duration: v.Duration().String(),
254254
})
255255
}
@@ -445,7 +445,7 @@ func Rerun(ctx *context_module.Context) {
445445
return
446446
}
447447
}
448-
ctx.JSON(http.StatusOK, struct{}{})
448+
ctx.JSONOK()
449449
return
450450
}
451451

@@ -460,12 +460,12 @@ func Rerun(ctx *context_module.Context) {
460460
}
461461
}
462462

463-
ctx.JSON(http.StatusOK, struct{}{})
463+
ctx.JSONOK()
464464
}
465465

466466
func rerunJob(ctx *context_module.Context, job *actions_model.ActionRunJob, shouldBlock bool) error {
467467
status := job.Status
468-
if !status.IsDone() {
468+
if !status.IsDone() || !job.Run.Status.IsDone() {
469469
return nil
470470
}
471471

0 commit comments

Comments
 (0)