diff options
author | Jason Song <i@wolfogre.com> | 2024-03-21 15:01:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-21 15:01:35 +0800 |
commit | b150ff0bab3fc6c419edf1569a0271ebcb9734fa (patch) | |
tree | 244e3ab96a5fad845f3a8cbe8b9612f317aa92ca /services/repository/branch.go | |
parent | 3ee39db34efd532626d710de6717bf3c6255c10e (diff) | |
download | gitea-b150ff0bab3fc6c419edf1569a0271ebcb9734fa.tar.gz gitea-b150ff0bab3fc6c419edf1569a0271ebcb9734fa.zip |
Cancel previous runs of the same PR automatically (#29961)
Follow #25716. Also cancel previous runs for `pull_request_sync`.
It's not a bug since it original PR said "if the event is push".
The main change is
https://github.com/go-gitea/gitea/pull/29961/files#diff-08adda3f8ae0360937f46abb1f4418603bd3518522baa356be11c6c7ac4abcc3.
And also rename `CancelRunningJobs` to `CancelPreviousJobs` to make it
more clear.
Diffstat (limited to 'services/repository/branch.go')
-rw-r--r-- | services/repository/branch.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/services/repository/branch.go b/services/repository/branch.go index 0353c75fe9..229ac54f30 100644 --- a/services/repository/branch.go +++ b/services/repository/branch.go @@ -410,14 +410,14 @@ func RenameBranch(ctx context.Context, repo *repo_model.Repository, doer *user_m log.Error("DeleteCronTaskByRepo: %v", err) } // cancel running cron jobs of this repository and delete old schedules - if err := actions_model.CancelRunningJobs( + if err := actions_model.CancelPreviousJobs( ctx, repo.ID, from, "", webhook_module.HookEventSchedule, ); err != nil { - log.Error("CancelRunningJobs: %v", err) + log.Error("CancelPreviousJobs: %v", err) } err2 = gitrepo.SetDefaultBranch(ctx, repo, to) @@ -575,14 +575,14 @@ func SetRepoDefaultBranch(ctx context.Context, repo *repo_model.Repository, gitR log.Error("DeleteCronTaskByRepo: %v", err) } // cancel running cron jobs of this repository and delete old schedules - if err := actions_model.CancelRunningJobs( + if err := actions_model.CancelPreviousJobs( ctx, repo.ID, oldDefaultBranchName, "", webhook_module.HookEventSchedule, ); err != nil { - log.Error("CancelRunningJobs: %v", err) + log.Error("CancelPreviousJobs: %v", err) } if err := gitrepo.SetDefaultBranch(ctx, repo, newBranchName); err != nil { |