From 5bc7b4a25cb4b3ca01dbfe23c025e0c5bd78807a Mon Sep 17 00:00:00 2001 From: Yun Wang Date: Sat, 5 Dec 2026 10:50:50 +0100 Subject: [PATCH 1/3] ci: report a stuck regen merge once per commit, with GitHub's reason Each Regenerate run that found an unmergeable regen PR waited 45 minutes and posted the same heads-up, so one stuck commit could post every day. The first run to give up now leaves a PR comment naming the commit and GitHub's last merge refusal; a later run on the same commit finds it and only logs a notice. The Slack line carries the refusal. --- .github/workflows/regen.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/regen.yml b/.github/workflows/regen.yml index ac14e65..5e2c903 100644 --- a/.github/workflows/regen.yml +++ b/.github/workflows/regen.yml @@ -141,6 +141,7 @@ jobs: if [ "$(grep '^BREAKING CHANGE: ' <<< "$body")" = "$(grep '^BREAKING CHANGE: ' <<< "${prev-$body}" || true)" ]; then hold "carries breaking changes" quiet; fi hold "$(held "$1")" fi + refusal= for _ in $(seq 45); do sleep 60 # A PR merged into $base during the wait leaves this one behind, and the up-to-date rule refuses the merge until it takes that in. The new head's checks start over, so the run its Regen integration starts on completion merges it, with a full wait of its own. @@ -168,11 +169,17 @@ jobs: ''|queued/|in_progress/|waiting/|pending/|requested/) continue ;; *) echo "::warning::could not read the Regen integration run of #$num at $1: $run"; continue ;; esac - gh pr merge "$num" --squash --admin --match-head-commit "$1" && exit 0 ;; + refusal=$(gh pr merge "$num" --squash --admin --match-head-commit "$1" 2>&1 | sed -e 's/^GraphQL: //' -e 's/ (mergePullRequest)$//' -e 's/\.$//' | paste -sd ' ' -) && exit 0 + echo "$refusal" ;; *) echo "::warning::could not read the required checks of #$num: $checks" ;; esac done - human "did not merge within 45 minutes" + # One heads-up per head commit: a later run that gives up on the same commit, such as the daily one, finds the PR comment the first one left and stays quiet. + marker="Did not merge $1 within 45 minutes" + comments=$(gh pr view "$num" --json comments --jq '.comments[].body') || comments= + if grep -qF "$marker" <<< "$comments"; then echo "::notice::#$num did not merge within 45 minutes, which an earlier run already reported for $1"; exit 0; fi + gh pr comment "$num" --body "$marker${refusal:+. GitHub says: $refusal}" || true + human "did not merge within 45 minutes${refusal:+. GitHub says: $refusal}" exit 1 } From aede2e792c5be473404743e873dc06ee74daa6ac Mon Sep 17 00:00:00 2001 From: Yun Wang Date: Sat, 5 Dec 2026 11:03:06 +0100 Subject: [PATCH 2/3] ci: report a stuck regen merge again when its reason changes A run that gave up while checks were still pending left a reasonless comment, which kept a later run's GitHub refusal out of Slack. The comment is now matched on the commit and the reason together. --- .github/workflows/regen.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/regen.yml b/.github/workflows/regen.yml index 5e2c903..9783549 100644 --- a/.github/workflows/regen.yml +++ b/.github/workflows/regen.yml @@ -174,12 +174,13 @@ jobs: *) echo "::warning::could not read the required checks of #$num: $checks" ;; esac done - # One heads-up per head commit: a later run that gives up on the same commit, such as the daily one, finds the PR comment the first one left and stays quiet. - marker="Did not merge $1 within 45 minutes" + # One heads-up per head commit and reason: a later run that gives up on the same commit for the same reason, such as the daily one, finds the PR comment the first one left and stays quiet. + reason=${refusal:+. GitHub says: $refusal} + marker="Did not merge $1 within 45 minutes$reason" comments=$(gh pr view "$num" --json comments --jq '.comments[].body') || comments= - if grep -qF "$marker" <<< "$comments"; then echo "::notice::#$num did not merge within 45 minutes, which an earlier run already reported for $1"; exit 0; fi - gh pr comment "$num" --body "$marker${refusal:+. GitHub says: $refusal}" || true - human "did not merge within 45 minutes${refusal:+. GitHub says: $refusal}" + if grep -qxF "$marker" <<< "$comments"; then echo "::notice::#$num did not merge within 45 minutes, which an earlier run already reported for $1"; exit 0; fi + gh pr comment "$num" --body "$marker" || true + human "did not merge within 45 minutes$reason" exit 1 } From 4f19a936d049bbff521d3bb82b390b6557f0e440 Mon Sep 17 00:00:00 2001 From: Yun Wang Date: Sat, 5 Dec 2026 12:47:24 +0100 Subject: [PATCH 3/3] ci: count only the app's own comments when deduping a stuck regen merge Anyone who can comment on the PR could post the marker line and mute the heads-up for that commit. --- .github/workflows/regen.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/regen.yml b/.github/workflows/regen.yml index 9783549..0bbcb15 100644 --- a/.github/workflows/regen.yml +++ b/.github/workflows/regen.yml @@ -174,10 +174,10 @@ jobs: *) echo "::warning::could not read the required checks of #$num: $checks" ;; esac done - # One heads-up per head commit and reason: a later run that gives up on the same commit for the same reason, such as the daily one, finds the PR comment the first one left and stays quiet. + # One heads-up per head commit and reason: a later run that gives up on the same commit for the same reason, such as the daily one, finds the PR comment the first one left and stays quiet. Only the app's own comments count, so no one else can mute the heads-up. reason=${refusal:+. GitHub says: $refusal} marker="Did not merge $1 within 45 minutes$reason" - comments=$(gh pr view "$num" --json comments --jq '.comments[].body') || comments= + comments=$(gh pr view "$num" --json comments --jq '.comments[] | select(.author.login == env.APP_SLUG) | .body') || comments= if grep -qxF "$marker" <<< "$comments"; then echo "::notice::#$num did not merge within 45 minutes, which an earlier run already reported for $1"; exit 0; fi gh pr comment "$num" --body "$marker" || true human "did not merge within 45 minutes$reason"