diff options
author | Earl Warren <contact@earl-warren.org> | 2024-01-22 16:06:50 +0100 |
---|---|---|
committer | Earl Warren <contact@earl-warren.org> | 2024-02-05 16:53:58 +0100 |
commit | 0fd9d08ea0f216230daae69750f596d96a5e5dfa (patch) | |
tree | 35a66645031765f02d024aaeb41c25bb8a8786a2 /services | |
parent | Revert "Fix an actions schedule bug (#28942)" (diff) | |
download | forgejo-0fd9d08ea0f216230daae69750f596d96a5e5dfa.tar.xz forgejo-0fd9d08ea0f216230daae69750f596d96a5e5dfa.zip |
Revert "Fix schedule not trigger bug because matching full ref name with short ref name (#28874)"
This reverts commit 23efd9d2781c2ac22594a83afa75182d276b1571.
(cherry picked from commit b263ac67e08fdd315f8bbb8de9eff81d85a579c1)
(cherry picked from commit 4699db575c074607c5b1f4ef1ff552185e040c06)
Diffstat (limited to 'services')
-rw-r--r-- | services/actions/notifier_helper.go | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/services/actions/notifier_helper.go b/services/actions/notifier_helper.go index 16a40366ac..217ae6c6b0 100644 --- a/services/actions/notifier_helper.go +++ b/services/actions/notifier_helper.go @@ -160,28 +160,24 @@ func notify(ctx context.Context, input *notifyInput) error { 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, + input.Event == webhook_module.HookEventPush && input.Ref == input.Repo.DefaultBranch, ) if err != nil { return fmt.Errorf("DetectWorkflows: %w", err) } - log.Trace("repo %s with commit %s event %s find %d workflows and %d schedules", - input.Repo.RepoPath(), - commit.ID, - input.Event, - len(workflows), - len(schedules), - ) - - for _, wf := range workflows { - if actionsConfig.IsWorkflowDisabled(wf.EntryName) { - log.Trace("repo %s has disable workflows %s", input.Repo.RepoPath(), wf.EntryName) - continue - } + if len(workflows) == 0 { + log.Trace("repo %s with commit %s couldn't find workflows", input.Repo.RepoPath(), commit.ID) + } else { + for _, wf := range workflows { + if actionsConfig.IsWorkflowDisabled(wf.EntryName) { + log.Trace("repo %s has disable workflows %s", input.Repo.RepoPath(), wf.EntryName) + continue + } - if wf.TriggerEvent.Name != actions_module.GithubEventPullRequestTarget { - detectedWorkflows = append(detectedWorkflows, wf) + if wf.TriggerEvent.Name != actions_module.GithubEventPullRequestTarget { + detectedWorkflows = append(detectedWorkflows, wf) + } } } |