Add ghpr script

This commit is contained in:
Rob Watson 2021-04-21 10:39:25 +02:00
parent bdb7203f05
commit 70224f8e71
1 changed files with 20 additions and 0 deletions

20
script/ghpr Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
#
# Open or create a GitHub PR in the browser
export GH_NO_UPDATE_NOTIFIER=1
output=$(gh pr view -w 2>&1)
exitcode=$?
if [ $exitcode -eq 0 ]; then
exit 0
fi
if echo "$output" | grep -q "no pull requests found"; then
echo "Opening new PR..."
gh pr create -w
else
echo $output
exit $exitcode
fi