Created
March 27, 2017 18:09
-
-
Save maxrothman/e4ea6a9ed66bd4c9678237081a97142e to your computer and use it in GitHub Desktop.
Wait for a PR to pass tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
USAGE="Usage: wait-on-status OWNER REPO PR#" | |
[ -z $1 ] || [ -z $2 ] || [ -z $3 ] && echo $USAGE && exit 2 | |
state="pending" | |
inloop=false | |
while [[ "$state" = "pending" ]]; do | |
$inloop && sleep 60 | |
sha=$(curl -s https://api.github.com/repos/$1/$2/pulls/$3/commits | jq -r '.[-1].sha') | |
state=$(curl -s https://api.github.com/repos/$1/$2/commits/$sha/status | jq -r '.state') | |
inloop=true | |
done | |
msg="$1/$2 #$3 is ${state^^}" | |
echo -ne "\e]9;$msg\007" | |
echo "$msg" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment