Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/regen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -168,11 +169,18 @@ 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 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[] | 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"
exit 1
}

Expand Down
Loading