Skip to content

Instantly share code, notes, and snippets.

@bryceosterhaus
Last active October 26, 2017 18:43
Show Gist options
  • Save bryceosterhaus/6109103e9725804f665cde6ab227783d to your computer and use it in GitHub Desktop.
Save bryceosterhaus/6109103e9725804f665cde6ab227783d to your computer and use it in GitHub Desktop.
# Submit pull-request
submit() {
jira-ticket "$2" | submit-with-title "$1" "$2"
}
submit-with-title() {
pipeVal=$(< /dev/stdin);
branch=$(get_branch)
if [ "$2" ]; then
branch="$2"
fi
if [ "$1" ]; then
gh pr --submit "$1" --title "$pipeVal" --description 'Jira Issue: '"[$branch](https://issues.liferay.com/browse/$branch)"'';
else
echo -e "Please enter correct format $fg_bold[red]submit <USER> <BRANCH>$reset_color"
fi
}
submit-no-title() {
if [ "$1 && $2" ]; then
gh pr --submit "$1" --branch "$2" --description 'Jira Issue: '"[$(get_branch)](https://issues.liferay.com/browse/$(get_branch))"''
else
echo -e "Please enter correct format $fg_bold[red]submit <USER> <BRANCH>$reset_color"
fi
}
get_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment