2021-03-31 10:47:59 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Select and checkout a GitHub pull request using the GitHub CLI (required)
|
|
|
|
set -e
|
|
|
|
|
2021-04-23 01:57:17 +00:00
|
|
|
export GH_NO_UPDATE_NOTIFIER=1
|
2021-10-19 14:36:17 +00:00
|
|
|
unset BROWSER
|
2021-04-23 01:57:17 +00:00
|
|
|
|
2021-08-13 08:07:28 +00:00
|
|
|
if [ "$1" = '-a' ]; then
|
|
|
|
cmd='gh pr list --limit 100'
|
|
|
|
elif [ -z "$GITHUB_USERNAME" ]; then
|
|
|
|
echo 'set $GITHUB_USERNAME first'
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
cmd="gh pr list --author $GITHUB_USERNAME"
|
|
|
|
fi
|
|
|
|
|
|
|
|
prid=$(eval "$cmd" | fzf | awk '{print $1}')
|
2021-03-31 10:47:59 +00:00
|
|
|
if [ -z $prid ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
gh pr checkout $prid
|