Skip to content

Commit

Permalink
ci/get-merge-commit.sh: Exit for non-open PRs
Browse files Browse the repository at this point in the history
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
  • Loading branch information
infinisil committed Oct 12, 2024
1 parent 7f9d297 commit 048f4aa
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ci/get-merge-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 048f4aa

Please sign in to comment.