Created
March 16, 2018 00:21
-
-
Save omniwired/c71fbd4f34a4b50803a87d1c42d356fb to your computer and use it in GitHub Desktop.
Create Pull requests from command line
This file contains hidden or 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 | |
# Set the targets branches | |
targets=( | |
'master' | |
'stage' | |
'develop' | |
) | |
# to create pull requests we need "hub" a piece of software made by github to programatically interact with GitHub | |
command -v hub >/dev/null 2>&1 || { echo "I require hub but it's not installed. Aborting. If you have brew and in a mac use 'brew install hub.'" >&2; exit 1; } | |
echo "Please provide a PR Title: " | |
read message | |
if [[ -z "${message// }" ]] | |
then | |
echo "ERROR: A message is required" | |
exit 1; | |
fi; | |
for i in "${!targets[@]}"; do | |
if [ ${targets[$i]} != '' ] | |
then | |
pr_title="${targets[$i]} <- $message" | |
echo "creating PR: $pr_title"; | |
hub pull-request -b ${targets[$i]} -m "$pr_title" | |
fi; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment