Skip to content

Commit 23efd9d

Browse files
authored
Fix schedule not trigger bug because matching full ref name with short ref name (go-gitea#28874)
Fix go-gitea#28533 Caused by go-gitea#28691
1 parent 692929b commit 23efd9d

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

services/actions/notifier_helper.go

+16-12
Original file line numberDiff line numberDiff line change
@@ -159,24 +159,28 @@ func notify(ctx context.Context, input *notifyInput) error {
159159
workflows, schedules, err := actions_module.DetectWorkflows(gitRepo, commit,
160160
input.Event,
161161
input.Payload,
162-
input.Event == webhook_module.HookEventPush && input.Ref == input.Repo.DefaultBranch,
162+
input.Event == webhook_module.HookEventPush && git.RefName(input.Ref).BranchName() == input.Repo.DefaultBranch,
163163
)
164164
if err != nil {
165165
return fmt.Errorf("DetectWorkflows: %w", err)
166166
}
167167

168-
if len(workflows) == 0 {
169-
log.Trace("repo %s with commit %s couldn't find workflows", input.Repo.RepoPath(), commit.ID)
170-
} else {
171-
for _, wf := range workflows {
172-
if actionsConfig.IsWorkflowDisabled(wf.EntryName) {
173-
log.Trace("repo %s has disable workflows %s", input.Repo.RepoPath(), wf.EntryName)
174-
continue
175-
}
168+
log.Trace("repo %s with commit %s event %s find %d workflows and %d schedules",
169+
input.Repo.RepoPath(),
170+
commit.ID,
171+
input.Event,
172+
len(workflows),
173+
len(schedules),
174+
)
176175

177-
if wf.TriggerEvent.Name != actions_module.GithubEventPullRequestTarget {
178-
detectedWorkflows = append(detectedWorkflows, wf)
179-
}
176+
for _, wf := range workflows {
177+
if actionsConfig.IsWorkflowDisabled(wf.EntryName) {
178+
log.Trace("repo %s has disable workflows %s", input.Repo.RepoPath(), wf.EntryName)
179+
continue
180+
}
181+
182+
if wf.TriggerEvent.Name != actions_module.GithubEventPullRequestTarget {
183+
detectedWorkflows = append(detectedWorkflows, wf)
180184
}
181185
}
182186

0 commit comments

Comments
 (0)