From bd75a2da3dbe225dc154cb497f5921170b905ea6 Mon Sep 17 00:00:00 2001 From: Lucas Santana Date: Sun, 12 Jul 2026 12:56:52 -0300 Subject: [PATCH] fix(ci): stop auto-update workflow racing on merge push The workflow fires on 'push: main' but GitHub hasn't recomputed queued PRs' mergeStateStatus to BEHIND yet (reads UNKNOWN), so a merge-triggered run updates zero PRs and strands the queue with no further push to re-fire it (observed: 7 PRs deadlocked after #1801 merged). Add a 45s settle on push + a */15 cron backstop that catches any stranded PR regardless of the race. --- .github/workflows/auto-update-pr-branches.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/auto-update-pr-branches.yml b/.github/workflows/auto-update-pr-branches.yml index 1035a60ab..1c53565f0 100644 --- a/.github/workflows/auto-update-pr-branches.yml +++ b/.github/workflows/auto-update-pr-branches.yml @@ -16,6 +16,13 @@ name: Auto-update PR branches on: push: branches: [main] + # Backstop: the push trigger fires the instant main advances, but GitHub often + # hasn't recomputed the other PRs' mergeStateStatus yet (it reads UNKNOWN, not + # BEHIND), so a merge-triggered run can update zero PRs and strand the queue + # with no further push to re-fire it. This cron catches any stranded PR within + # ~15 min regardless of the race. + schedule: + - cron: "*/15 * * * *" workflow_dispatch: permissions: @@ -36,6 +43,10 @@ jobs: REPO: ${{ github.repository }} run: | set -euo pipefail + # On a merge push, GitHub needs a moment to recompute the queued PRs' + # mergeStateStatus to BEHIND; without this settle the list reads them + # as UNKNOWN and updates none. The cron backstop covers the rest. + if [ "${GITHUB_EVENT_NAME:-}" = "push" ]; then sleep 45; fi gh pr list --repo "$REPO" --state open --base main \ --json number,isDraft,mergeStateStatus,autoMergeRequest \ --jq '.[]