Fix schedule not trigger bug because matching full ref name with short ref name (#28874)

Fix #28533

Caused by #28691
pull/28886/head^2
Lunny Xiao 10 months ago committed by GitHub
parent 692929b628
commit 23efd9d278
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 14
      services/actions/notifier_helper.go

@ -159,15 +159,20 @@ 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 {
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)
@ -178,7 +183,6 @@ func notify(ctx context.Context, input *notifyInput) error {
detectedWorkflows = append(detectedWorkflows, wf)
}
}
}
if input.PullRequest != nil {
// detect pull_request_target workflows

Loading…
Cancel
Save