Created
May 19, 2016 18:02
-
-
Save AntonTyutin/7ef9006364b5649388d7a52c848e97f5 to your computer and use it in GitHub Desktop.
Make GitHub pull-request from an issue
This file contains 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 | |
// export GITHUB_API_TOKEN=051e00e0fd07b55f661da8c3068befa06518227e | |
NL=" | |
" | |
NL2="$NL$NL" | |
HELP="$NL2 Usage: $0 vendor/repo feature_branch 15 master$NL Make sure you export GITHUB_API_TOKEN environment variable$NL2" | |
REPO=${1:?"$NL2 A repository name (vendor/repo) must be specified.$HELP"} | |
HEAD=${2:?"$NL2 A branch name must be specified.$HELP"} | |
ISSUE=${3:?"$NL2 An issue id must be specified.$HELP"} | |
BASE=${4:-'master'} | |
curl \ | |
-H "Authorization: token $GITHUB_API_TOKEN" \ | |
--request POST \ | |
--data "{\"issue\": \"$ISSUE\", \"head\": \"$HEAD\", \"base\": \"$BASE\"}" \ | |
"https://api.github.com/repos/$REPO/pulls" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment