Skip to content

Commit d0386a6

Browse files
committed
update job.Status on re-run trigger to avoid duplicate email notifications
1 parent 80e3c30 commit d0386a6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

routers/web/repo/actions/view.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,14 @@ func Rerun(ctx *context_module.Context) {
420420
return
421421
}
422422

423-
// reset run's start and stop time when it is done
423+
// reset run's start and stop time when if is done
424424
if run.Status.IsDone() {
425425
run.PreviousDuration = run.Duration()
426426
run.Started = 0
427427
run.Stopped = 0
428+
// Set run to waiting status so next job.Status evaluations reflect the status after the re-run trigger
429+
// Avoid re-triggering email notification before the new job run ends
430+
run.Status = 1
428431
if err := actions_model.UpdateRun(ctx, run, "started", "stopped", "previous_duration"); err != nil {
429432
ctx.ServerError("UpdateRun", err)
430433
return

0 commit comments

Comments
 (0)