mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 12:15:34 +03:00
ci/get-merge-commit.sh: Add documentation
And distinguish exit codes
This commit is contained in:
parent
048f4aa537
commit
e6a8855a14
2 changed files with 59 additions and 5 deletions
|
@ -1,6 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
# This checks for mergeability of a pull request as recommended in
|
||||
# https://docs.github.com/en/rest/guides/using-the-rest-api-to-interact-with-your-git-database?apiVersion=2022-11-28#checking-mergeability-of-pull-requests
|
||||
# See ./README.md for docs
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
|
@ -31,14 +30,14 @@ while true; do
|
|||
state=$(jq -r .state <<< "$prInfo")
|
||||
if [[ "$state" != open ]]; then
|
||||
log "PR is not open anymore"
|
||||
exit 2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mergeable=$(jq -r .mergeable <<< "$prInfo")
|
||||
if [[ "$mergeable" == "null" ]]; then
|
||||
if (( retryCount == 0 )); then
|
||||
log "Not retrying anymore. It's likely that GitHub is having internal issues: check https://www.githubstatus.com/"
|
||||
exit 1
|
||||
exit 3
|
||||
else
|
||||
(( retryCount -= 1 )) || true
|
||||
|
||||
|
@ -59,5 +58,5 @@ if [[ "$mergeable" == "true" ]]; then
|
|||
jq -r .merge_commit_sha <<< "$prInfo"
|
||||
else
|
||||
log "The PR has a merge conflict"
|
||||
exit 1
|
||||
exit 2
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue