mirror of
https://github.com/go-gitea/gitea.git
synced 2025-12-02 06:09:44 +01:00
fix rerun
This commit is contained in:
parent
98ff7d0773
commit
2376eb3055
@ -412,6 +412,12 @@ func Rerun(ctx *context_module.Context) {
|
|||||||
return
|
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
|
// can not rerun job when workflow is disabled
|
||||||
cfgUnit := ctx.Repo.Repository.MustGetUnit(ctx, unit.TypeActions)
|
cfgUnit := ctx.Repo.Repository.MustGetUnit(ctx, unit.TypeActions)
|
||||||
cfg := cfgUnit.ActionsConfig()
|
cfg := cfgUnit.ActionsConfig()
|
||||||
@ -420,15 +426,7 @@ func Rerun(ctx *context_module.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// check run (workflow-level) concurrency
|
// reset run's start and stop time
|
||||||
|
|
||||||
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() {
|
|
||||||
run.PreviousDuration = run.Duration()
|
run.PreviousDuration = run.Duration()
|
||||||
run.Started = 0
|
run.Started = 0
|
||||||
run.Stopped = 0
|
run.Stopped = 0
|
||||||
@ -469,6 +467,10 @@ func Rerun(ctx *context_module.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
notify_service.WorkflowRunStatusUpdate(ctx, run.Repo, run.TriggerUser, run)
|
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
|
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 {
|
func rerunJob(ctx *context_module.Context, job *actions_model.ActionRunJob, shouldBlock bool) error {
|
||||||
status := job.Status
|
status := job.Status
|
||||||
if !status.IsDone() || !job.Run.Status.IsDone() {
|
if !status.IsDone() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user