Fix schedule not trigger bug because matching full ref name with short ref name (#28874)
Fix #28533 Caused by #28691
This commit is contained in:
parent
692929b628
commit
23efd9d278
|
@ -159,24 +159,28 @@ func notify(ctx context.Context, input *notifyInput) error {
|
||||||
workflows, schedules, err := actions_module.DetectWorkflows(gitRepo, commit,
|
workflows, schedules, err := actions_module.DetectWorkflows(gitRepo, commit,
|
||||||
input.Event,
|
input.Event,
|
||||||
input.Payload,
|
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 {
|
if err != nil {
|
||||||
return fmt.Errorf("DetectWorkflows: %w", err)
|
return fmt.Errorf("DetectWorkflows: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(workflows) == 0 {
|
log.Trace("repo %s with commit %s event %s find %d workflows and %d schedules",
|
||||||
log.Trace("repo %s with commit %s couldn't find workflows", input.Repo.RepoPath(), commit.ID)
|
input.Repo.RepoPath(),
|
||||||
} else {
|
commit.ID,
|
||||||
for _, wf := range workflows {
|
input.Event,
|
||||||
if actionsConfig.IsWorkflowDisabled(wf.EntryName) {
|
len(workflows),
|
||||||
log.Trace("repo %s has disable workflows %s", input.Repo.RepoPath(), wf.EntryName)
|
len(schedules),
|
||||||
continue
|
)
|
||||||
}
|
|
||||||
|
|
||||||
if wf.TriggerEvent.Name != actions_module.GithubEventPullRequestTarget {
|
for _, wf := range workflows {
|
||||||
detectedWorkflows = append(detectedWorkflows, wf)
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue