diff options
author | Zettat123 <zettat123@gmail.com> | 2024-10-14 04:28:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-13 20:28:32 +0000 |
commit | 81aec6d621a3ea0dfb02d3b4d20b9be77c30c6ab (patch) | |
tree | 5bf0d3ad40a87dc43fb9f2ad5d579129bb11d717 | |
parent | 74664b08a004393ce013e872e47901f52645b65a (diff) | |
download | gitea-81aec6d621a3ea0dfb02d3b4d20b9be77c30c6ab.tar.gz gitea-81aec6d621a3ea0dfb02d3b4d20b9be77c30c6ab.zip |
Update scheduled tasks even if changes are pushed by "ActionsUser" (#32246)
Fix #32219
---------
Co-authored-by: delvh <dev.lh@web.de>
-rw-r--r-- | services/actions/notifier_helper.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/services/actions/notifier_helper.go b/services/actions/notifier_helper.go index b21d889d03..323c6a76e4 100644 --- a/services/actions/notifier_helper.go +++ b/services/actions/notifier_helper.go @@ -116,11 +116,20 @@ func (input *notifyInput) Notify(ctx context.Context) { } func notify(ctx context.Context, input *notifyInput) error { + shouldDetectSchedules := input.Event == webhook_module.HookEventPush && input.Ref.BranchName() == input.Repo.DefaultBranch if input.Doer.IsActions() { // avoiding triggering cyclically, for example: // a comment of an issue will trigger the runner to add a new comment as reply, // and the new comment will trigger the runner again. log.Debug("ignore executing %v for event %v whose doer is %v", getMethod(ctx), input.Event, input.Doer.Name) + + // we should update schedule tasks in this case, because + // 1. schedule tasks cannot be triggered by other events, so cyclic triggering will not occur + // 2. some schedule tasks may update the repo periodically, so the refs of schedule tasks need to be updated + if shouldDetectSchedules { + return DetectAndHandleSchedules(ctx, input.Repo) + } + return nil } if input.Repo.IsEmpty || input.Repo.IsArchived { @@ -174,7 +183,6 @@ func notify(ctx context.Context, input *notifyInput) error { var detectedWorkflows []*actions_module.DetectedWorkflow actionsConfig := input.Repo.MustGetUnit(ctx, unit_model.TypeActions).ActionsConfig() - shouldDetectSchedules := input.Event == webhook_module.HookEventPush && input.Ref.BranchName() == input.Repo.DefaultBranch workflows, schedules, err := actions_module.DetectWorkflows(gitRepo, commit, input.Event, input.Payload, |