aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web
diff options
context:
space:
mode:
authorsillyguodong <33891828+sillyguodong@users.noreply.github.com>2024-02-27 15:40:21 +0800
committerGitHub <noreply@github.com>2024-02-27 07:40:21 +0000
commitbad4ad70181c747599e206c0e7a87b57c997385d (patch)
tree2952b4964cc4d7ee02591633df8c270cbd2a09cb /routers/web
parent29f149bd9f517225a3c9f1ca3fb0a7b5325af696 (diff)
downloadgitea-bad4ad70181c747599e206c0e7a87b57c997385d.tar.gz
gitea-bad4ad70181c747599e206c0e7a87b57c997385d.zip
Not trigger all jobs any more, when re-running the first job (#29439)
Previously, it will be treated as "re-run all jobs" when `jobIndex == 0`. So when you click re-run button on the first job, it triggers all the jobs actually.
Diffstat (limited to 'routers/web')
-rw-r--r--routers/web/repo/actions/view.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/routers/web/repo/actions/view.go b/routers/web/repo/actions/view.go
index 2f26e710cd..52c3cf1d07 100644
--- a/routers/web/repo/actions/view.go
+++ b/routers/web/repo/actions/view.go
@@ -12,6 +12,7 @@ import (
"io"
"net/http"
"net/url"
+ "strconv"
"strings"
"time"
@@ -262,10 +263,14 @@ func ViewPost(ctx *context_module.Context) {
}
// Rerun will rerun jobs in the given run
-// jobIndex = 0 means rerun all jobs
+// If jobIndexStr is a blank string, it means rerun all jobs
func Rerun(ctx *context_module.Context) {
runIndex := ctx.ParamsInt64("run")
- jobIndex := ctx.ParamsInt64("job")
+ jobIndexStr := ctx.Params("job")
+ var jobIndex int64
+ if jobIndexStr != "" {
+ jobIndex, _ = strconv.ParseInt(jobIndexStr, 10, 64)
+ }
run, err := actions_model.GetRunByIndex(ctx, ctx.Repo.Repository.ID, runIndex)
if err != nil {
@@ -297,7 +302,7 @@ func Rerun(ctx *context_module.Context) {
return
}
- if jobIndex != 0 {
+ if jobIndexStr != "" {
jobs = []*actions_model.ActionRunJob{job}
}