Skip to content

Commit bad4ad7

Browse files
authored
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.
1 parent 29f149b commit bad4ad7

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

@@ -262,10 +263,14 @@ func ViewPost(ctx *context_module.Context) {
262263
}
263264

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

270275
run, err := actions_model.GetRunByIndex(ctx, ctx.Repo.Repository.ID, runIndex)
271276
if err != nil {
@@ -297,7 +302,7 @@ func Rerun(ctx *context_module.Context) {
297302
return
298303
}
299304

300-
if jobIndex != 0 {
305+
if jobIndexStr != "" {
301306
jobs = []*actions_model.ActionRunJob{job}
302307
}
303308

0 commit comments

Comments
 (0)