0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-12-01 10:55:16 +01:00

fix rerun

This commit is contained in:
Zettat123 2025-10-29 15:26:20 -06:00
parent 98ff7d0773
commit 2376eb3055

View File

@ -412,6 +412,12 @@ func Rerun(ctx *context_module.Context) {
return
}
// rerun is not allowed if the run is not done
if !run.Status.IsDone() {
ctx.JSONError(ctx.Locale.Tr("actions.runs.not_done"))
return
}
// can not rerun job when workflow is disabled
cfgUnit := ctx.Repo.Repository.MustGetUnit(ctx, unit.TypeActions)
cfg := cfgUnit.ActionsConfig()
@ -420,15 +426,7 @@ func Rerun(ctx *context_module.Context) {
return
}
// check run (workflow-level) concurrency
job, jobs := getRunJobs(ctx, runIndex, jobIndex)
if ctx.Written() {
return
}
// reset run's start and stop time when it is done
if run.Status.IsDone() {
// reset run's start and stop time
run.PreviousDuration = run.Duration()
run.Started = 0
run.Stopped = 0
@ -469,6 +467,10 @@ func Rerun(ctx *context_module.Context) {
return
}
notify_service.WorkflowRunStatusUpdate(ctx, run.Repo, run.TriggerUser, run)
job, jobs := getRunJobs(ctx, runIndex, jobIndex)
if ctx.Written() {
return
}
isRunBlocked := run.Status == actions_model.StatusBlocked
@ -501,7 +503,7 @@ func Rerun(ctx *context_module.Context) {
func rerunJob(ctx *context_module.Context, job *actions_model.ActionRunJob, shouldBlock bool) error {
status := job.Status
if !status.IsDone() || !job.Run.Status.IsDone() {
if !status.IsDone() {
return nil
}