Created
March 22, 2012 07:13
-
-
Save ihanson/2156799 to your computer and use it in GitHub Desktop.
Attaching a pull request to an existing GitHub 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
#!/usr/bin/env bash | |
read -p "GitHub username: " -ei $(git config --get github.user) USERNAME | |
read -sp "GitHub password: " PASSWORD | |
echo | |
read -p "Submit pull request to user: " TO_USER | |
read -p "Submit pull request to repository: " TO_REPO | |
read -p "Submit pull request to branch: " -ei master TO_BRANCH | |
read -p "Submit pull request from user: " -ei $USERNAME FROM_USER | |
read -p "Submit pull request from branch: " FROM_BRANCH | |
read -p "Issue number to attach pull request to: " ISSUE | |
read -p "Submit pull request? (y/n) " | |
if [[ $REPLY =~ ^[Yy] ]]; then | |
curl -X POST -u "$USERNAME:$PASSWORD" "https://api.github.com/repos/$TO_USER/$TO_REPO/pulls" \ | |
-d "{\"issue\":\"$ISSUE\",\"head\":\"$FROM_USER:$FROM_BRANCH\",\"base\":\"$TO_BRANCH\"}"; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for providing this! Just a guess, but should curl use
--data-urlencode
instead of-d
just in case something needs to be encoded? Or should the content-type be json:-H "Content-Type: application/json" -H "Accept: application/json"
?