Created
January 21, 2016 03:25
-
-
Save clehner/5cf0af6d96321a36e94c to your computer and use it in GitHub Desktop.
Attach a pull request to an existing issue on GitHub
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/sh | |
# http://stackoverflow.com/questions/4528869/how-do-you-attach-a-new-pull-request-to-an-existing-issue-on-github | |
if [ $# -lt 4 ]; then | |
echo "Usage: ${0##*/} [issue_num] [username/repo] [base_branch] [head_username:branch]" >&2 | |
exit 1 | |
fi | |
user="$(pass github.com|awk '/^username:/{print $2}')" | |
issue=$1 | |
repo=$2 | |
base=$3 | |
head=$4 | |
curl --user "$user" \ | |
--header "X-GitHub-OTP: $(read -p 'Enter OTP: ' otp; echo $otp)" \ | |
-d "{\"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