ci/get-merge-commit.sh: Exit for non-open PRs

If PRs aren't open (either merged or closed), GitHub never computes
whether the PR is mergeable, so we'd wait forever, which has been
happening:
https://github.com/NixOS/nixpkgs/actions/runs/11279197077/job/31369348101#step:2:59
This commit is contained in:
Silvan Mosberger 2024-10-10 20:11:56 +02:00
parent 7f9d297838
commit 048f4aa537

View File

@ -26,6 +26,14 @@ while true; do
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/$repo/pulls/$prNumber")
# Non-open PRs won't have their mergeability computed no matter what
state=$(jq -r .state <<< "$prInfo")
if [[ "$state" != open ]]; then
log "PR is not open anymore"
exit 2
fi
mergeable=$(jq -r .mergeable <<< "$prInfo")
if [[ "$mergeable" == "null" ]]; then
if (( retryCount == 0 )); then