Skip to content

Commit 0fd9d08

Browse files
committed
Revert "Fix schedule not trigger bug because matching full ref name with short ref name (go-gitea#28874)"
This reverts commit 23efd9d. (cherry picked from commit b263ac67e08fdd315f8bbb8de9eff81d85a579c1) (cherry picked from commit 4699db575c074607c5b1f4ef1ff552185e040c06)
1 parent f7fd1c7 commit 0fd9d08

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

services/actions/notifier_helper.go

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

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

183-
if wf.TriggerEvent.Name != actions_module.GithubEventPullRequestTarget {
184-
detectedWorkflows = append(detectedWorkflows, wf)
178+
if wf.TriggerEvent.Name != actions_module.GithubEventPullRequestTarget {
179+
detectedWorkflows = append(detectedWorkflows, wf)
180+
}
185181
}
186182
}
187183

0 commit comments

Comments
 (0)