From 0a469e36773026d43ec28357e502d83c971e32f0 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 06d314b4..370bcdf4 100644 --- a/.github/workflows/regen.yml +++ b/.github/workflows/regen.yml @@ -147,6 +147,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. @@ -174,11 +175,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 33370c93070dd332b8bc2c9eb2e88d75ea7c73cb Mon Sep 17 00:00:00 2001 From: Yun Wang Date: Sat, 5 Dec 2026 11:03:21 +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 370bcdf4..e8605636 100644 --- a/.github/workflows/regen.yml +++ b/.github/workflows/regen.yml @@ -180,12 +180,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 910b161af8939bf16d5e73397721c31b1f8c137e Mon Sep 17 00:00:00 2001 From: Yun Wang Date: Sat, 5 Dec 2026 12:47:25 +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 e8605636..2c404766 100644 --- a/.github/workflows/regen.yml +++ b/.github/workflows/regen.yml @@ -180,10 +180,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"