Skip to content

Commit 9456deb

Browse files
Not trigger all jobs any more, when re-running the first job (#29439) (#29441)
Backport #29439 by @sillyguodong 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. Caused by #26535. Co-authored-by: sillyguodong <[email protected]>
1 parent c758a8a commit 9456deb

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

routers/web/repo/actions/view.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"io"
1313
"net/http"
1414
"net/url"
15+
"strconv"
1516
"strings"
1617
"time"
1718

@@ -260,10 +261,14 @@ func ViewPost(ctx *context_module.Context) {
260261
}
261262

262263
// Rerun will rerun jobs in the given run
263-
// jobIndex = 0 means rerun all jobs
264+
// If jobIndexStr is a blank string, it means rerun all jobs
264265
func Rerun(ctx *context_module.Context) {
265266
runIndex := ctx.ParamsInt64("run")
266-
jobIndex := ctx.ParamsInt64("job")
267+
jobIndexStr := ctx.Params("job")
268+
var jobIndex int64
269+
if jobIndexStr != "" {
270+
jobIndex, _ = strconv.ParseInt(jobIndexStr, 10, 64)
271+
}
267272

268273
run, err := actions_model.GetRunByIndex(ctx, ctx.Repo.Repository.ID, runIndex)
269274
if err != nil {
@@ -284,7 +289,7 @@ func Rerun(ctx *context_module.Context) {
284289
return
285290
}
286291

287-
if jobIndex != 0 {
292+
if jobIndexStr != "" {
288293
jobs = []*actions_model.ActionRunJob{job}
289294
}
290295

0 commit comments

Comments
 (0)