forked from gitea/gitea
Backport #29091 Fix #29040 `handleSchedules` should be called only if `DetectWorkflows` should detect schedule workflows
This commit is contained in:
parent
933cc4da64
commit
7e0299b4fd
|
@ -149,10 +149,11 @@ func notify(ctx context.Context, input *notifyInput) error {
|
||||||
|
|
||||||
var detectedWorkflows []*actions_module.DetectedWorkflow
|
var detectedWorkflows []*actions_module.DetectedWorkflow
|
||||||
actionsConfig := input.Repo.MustGetUnit(ctx, unit_model.TypeActions).ActionsConfig()
|
actionsConfig := input.Repo.MustGetUnit(ctx, unit_model.TypeActions).ActionsConfig()
|
||||||
|
shouldDetectSchedules := input.Event == webhook_module.HookEventPush && git.RefName(input.Ref).BranchName() == input.Repo.DefaultBranch
|
||||||
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 && git.RefName(input.Ref).BranchName() == input.Repo.DefaultBranch,
|
shouldDetectSchedules,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("DetectWorkflows: %w", err)
|
return fmt.Errorf("DetectWorkflows: %w", err)
|
||||||
|
@ -199,9 +200,11 @@ func notify(ctx context.Context, input *notifyInput) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if shouldDetectSchedules {
|
||||||
if err := handleSchedules(ctx, schedules, commit, input, ref); err != nil {
|
if err := handleSchedules(ctx, schedules, commit, input, ref); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return handleWorkflows(ctx, detectedWorkflows, commit, input, ref)
|
return handleWorkflows(ctx, detectedWorkflows, commit, input, ref)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue