From 048f4aa537ec81b23454d61f559e31477e4f7af2 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Thu, 10 Oct 2024 20:11:56 +0200 Subject: [PATCH] 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 --- ci/get-merge-commit.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ci/get-merge-commit.sh b/ci/get-merge-commit.sh index 8d4877ecc4c3..75fc7fcbe60f 100755 --- a/ci/get-merge-commit.sh +++ b/ci/get-merge-commit.sh @@ -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