diff options
author | Zettat123 <zettat123@gmail.com> | 2024-02-08 21:00:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-08 13:00:17 +0000 |
commit | e600c35f066c79b717dc0c416b07d5c34502d286 (patch) | |
tree | 74840b7785da8dc434cefeb19558bd438e863a08 /services | |
parent | 8c6ffdac378654f9d2171ebdbc46becf1571f7fe (diff) | |
download | gitea-e600c35f066c79b717dc0c416b07d5c34502d286.tar.gz gitea-e600c35f066c79b717dc0c416b07d5c34502d286.zip |
Only delete scheduled workflows when needed (#29091)
Fix #29040
`handleSchedules` should be called only if `DetectWorkflows` should
detect schedule workflows
Diffstat (limited to 'services')
-rw-r--r-- | services/actions/notifier_helper.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/services/actions/notifier_helper.go b/services/actions/notifier_helper.go index 77173e58a3..8852f23c5f 100644 --- a/services/actions/notifier_helper.go +++ b/services/actions/notifier_helper.go @@ -157,10 +157,11 @@ 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 && git.RefName(input.Ref).BranchName() == input.Repo.DefaultBranch workflows, schedules, err := actions_module.DetectWorkflows(gitRepo, commit, input.Event, input.Payload, - input.Event == webhook_module.HookEventPush && git.RefName(input.Ref).BranchName() == input.Repo.DefaultBranch, + shouldDetectSchedules, ) if err != nil { return fmt.Errorf("DetectWorkflows: %w", err) @@ -207,8 +208,10 @@ func notify(ctx context.Context, input *notifyInput) error { } } - if err := handleSchedules(ctx, schedules, commit, input, ref); err != nil { - return err + if shouldDetectSchedules { + if err := handleSchedules(ctx, schedules, commit, input, ref); err != nil { + return err + } } return handleWorkflows(ctx, detectedWorkflows, commit, input, ref) |