Last active
June 23, 2021 12:01
-
-
Save pracucci/f4476b9d7daed3844eb822ba07a43ebf to your computer and use it in GitHub Desktop.
Run this script in any location containing a GitHub repository checkout/clone and it will guess the next PR number if you're going to open it shortly
This file contains 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
#!/bin/bash | |
LAST_PR=$(hub pr list --state all -L 1 --format '%I') | |
LAST_ISSUE=$(hub issue --format '%I' -L 1) | |
if [ "$LAST_PR" == "" -a "$LAST_ISSUE" == "" ]; then | |
echo "Unable to get last PR and/or Issue number. Is your current working directory a public GitHub repository?" | |
exit 1 | |
elif [ "$LAST_PR" -gt "$LAST_ISSUE" ]; then | |
echo `expr $LAST_PR + 1` | |
else | |
echo `expr $LAST_ISSUE + 1` | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment