From 31a7d1b65d3a858ed5d618d7464110828f190b3d Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Mon, 11 May 2026 19:45:56 +0200 Subject: [PATCH] Fix automerge: only trigger on success, not every status update Filter status events to state=='success' in the job condition. Eliminates runs for pending/error/failure states. The workflow now only comments/merges once ALL required statuses are green. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/automerge-docs.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/automerge-docs.yml b/.github/workflows/automerge-docs.yml index e304ae1e..4eb8495d 100644 --- a/.github/workflows/automerge-docs.yml +++ b/.github/workflows/automerge-docs.yml @@ -14,8 +14,10 @@ permissions: jobs: check-and-merge: - # Only run when a Learn Build status reports on the automation branch + # Only run when a Learn Build status succeeds on the automation branch. + # Ignore pending/error/failure — we only care when a status completes green. if: | + github.event.state == 'success' && (github.event.context == 'OpenPublishing.Build' || github.event.context == 'PoliCheck Scan') && contains(github.event.branches.*.name, 'automation/write-api-docs')