aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorBo-Yi Wu <appleboy.tw@gmail.com>2023-07-25 11:15:55 +0800
committerGitHub <noreply@github.com>2023-07-25 11:15:55 +0800
commit44781f9f5c4ede618660d8cfe42437f0e8dc22a0 (patch)
treeefcdc2e7876ede8c7e721432760e6ef9cefe4806 /routers
parent5db640abcd8608b065a1b390404bba2233220c95 (diff)
downloadgitea-44781f9f5c4ede618660d8cfe42437f0e8dc22a0.tar.gz
gitea-44781f9f5c4ede618660d8cfe42437f0e8dc22a0.zip
Implement auto-cancellation of concurrent jobs if the event is push (#25716)
- cancel running jobs if the event is push - Add a new function `CancelRunningJobs` to cancel all running jobs of a run - Update `FindRunOptions` struct to include `Ref` field and update its condition in `toConds` function - Implement auto cancellation of running jobs in the same workflow in `notify` function related task: https://github.com/go-gitea/gitea/pull/22751/ --------- Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> Signed-off-by: appleboy <appleboy.tw@gmail.com> Co-authored-by: Jason Song <i@wolfogre.com> Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'routers')
-rw-r--r--routers/web/repo/actions/actions.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/routers/web/repo/actions/actions.go b/routers/web/repo/actions/actions.go
index d215201bcd..5a12f52dcd 100644
--- a/routers/web/repo/actions/actions.go
+++ b/routers/web/repo/actions/actions.go
@@ -150,10 +150,14 @@ func List(ctx *context.Context) {
Page: page,
PageSize: convert.ToCorrectPageSize(ctx.FormInt("limit")),
},
- RepoID: ctx.Repo.Repository.ID,
- WorkflowFileName: workflow,
- TriggerUserID: actorID,
- Status: actions_model.Status(status),
+ RepoID: ctx.Repo.Repository.ID,
+ WorkflowID: workflow,
+ TriggerUserID: actorID,
+ }
+
+ // if status is not StatusUnknown, it means user has selected a status filter
+ if actions_model.Status(status) != actions_model.StatusUnknown {
+ opts.Status = []actions_model.Status{actions_model.Status(status)}
}
runs, total, err := actions_model.FindRuns(ctx, opts)