Oliver Davies
e76f02f64b
Rewritten in bash and as a wrapper around GitHub's `gh` command. - Pushed an unpushed branch to origin. - Opens an existing pull request if one exists. - Creates a new pull request if one doesn't exist.
27 lines
422 B
Bash
Executable file
27 lines
422 B
Bash
Executable file
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
ensure_is_published() {
|
|
[[ ! $is_published ]] && git publish
|
|
}
|
|
|
|
is_published() {
|
|
echo $(git upstream)
|
|
}
|
|
|
|
open_or_build_pull_request() {
|
|
type gh &>/dev/null
|
|
|
|
if [ $? -ne 0 ]; then
|
|
echo "Error: gh command not found."
|
|
exit 1
|
|
fi
|
|
|
|
# Load an existing PR, or create a new one.
|
|
gh pr view --web || gh pr create --assignee opdavies --web
|
|
}
|
|
|
|
ensure_is_published
|
|
open_or_build_pull_request
|