summaryrefslogtreecommitdiffstats
path: root/services/actions
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2024-01-22 03:13:24 +0100
committerGitHub <noreply@github.com>2024-01-22 03:13:24 +0100
commit23efd9d2781c2ac22594a83afa75182d276b1571 (patch)
tree351ef1de35332632710bd5c5fb3bb663f51ffdc0 /services/actions
parent[skip ci] Updated licenses and gitignores (diff)
downloadforgejo-23efd9d2781c2ac22594a83afa75182d276b1571.tar.xz
forgejo-23efd9d2781c2ac22594a83afa75182d276b1571.zip
Fix schedule not trigger bug because matching full ref name with short ref name (#28874)
Fix #28533 Caused by #28691
Diffstat (limited to 'services/actions')
-rw-r--r--services/actions/notifier_helper.go28
1 files changed, 16 insertions, 12 deletions
diff --git a/services/actions/notifier_helper.go b/services/actions/notifier_helper.go
index 0618f15602..2a3ffb76f3 100644
--- a/services/actions/notifier_helper.go
+++ b/services/actions/notifier_helper.go
@@ -159,24 +159,28 @@ 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 && input.Ref == input.Repo.DefaultBranch,
+ input.Event == webhook_module.HookEventPush && git.RefName(input.Ref).BranchName() == input.Repo.DefaultBranch,
)
if err != nil {
return fmt.Errorf("DetectWorkflows: %w", err)
}
- 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
- }
+ 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),
+ )
- if wf.TriggerEvent.Name != actions_module.GithubEventPullRequestTarget {
- detectedWorkflows = append(detectedWorkflows, wf)
- }
+ 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)
}
}