From af5959939142eed9083c2ea0491ee7e37cd0cb5e 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 b2c9eb45ee212..495ab0208e053 100755 --- a/ci/get-merge-commit.sh +++ b/ci/get-merge-commit.sh @@ -22,6 +22,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") mergedSha=$(jq -r .merge_commit_sha <<< "$prInfo")