From c3f6f133775fefd8bcf362d8ab4d33bae7e085e3 Mon Sep 17 00:00:00 2001 From: Christopher Homberger Date: Mon, 17 Mar 2025 22:23:14 +0100 Subject: [PATCH] prevent endless workflow_run trigger --- services/actions/notifier_helper.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/actions/notifier_helper.go b/services/actions/notifier_helper.go index c4179c0a06..3b07cc688e 100644 --- a/services/actions/notifier_helper.go +++ b/services/actions/notifier_helper.go @@ -263,6 +263,15 @@ func skipWorkflows(input *notifyInput, commit *git.Commit) bool { } } } + if input.Event == webhook_module.HookEventWorkflowRun { + wrun, ok := input.Payload.(*api.WorkflowRunPayload) + if ok && wrun.WorkflowRun != nil && wrun.WorkflowRun.Event != "workflow_run" { + // skip workflow runs triggered by another workflow run + // TODO GitHub allows chaining up to 5 of them + log.Debug("repo %s: skipped workflow_run because of recursive event", input.Repo.RepoPath()) + return true + } + } return false }