Forked from JanTvrdik/add_pull_request_to_issue_github.sh
Created
June 6, 2016 19:25
-
-
Save hrach/f309cd7e656db3217f4bb1d7453507de to your computer and use it in GitHub Desktop.
Add pull request to 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/bash | |
current_branch="$(git symbolic-ref HEAD 2>/dev/null)" || current_branch="(unknown)" | |
current_branch=${current_branch##refs/heads/} | |
github_username="JanTvrdik" | |
github_token="..." | |
if [[ $current_branch = "(unknown)" ]] | |
then | |
echo "Unable to determine current branch!" | |
exit 1 | |
fi | |
echo "Project owner:" | |
echo " (the guy or the company which must accept your pull request)" | |
echo " (https://github.com/symfony/TwigBundle -> symfony)" | |
read owner | |
echo "Project name:" | |
echo " (https://github.com/symfony/TwigBundle -> TwigBundle)" | |
read project | |
echo "Issue number:" | |
read issue | |
echo "Base commit / branch (usually master):" | |
read base | |
curl \ | |
-d "{ \"base\": \"$base\", \"head\": \"$github_username:$current_branch\", \"issue\": \"$issue\"}" \ | |
-u "$github_token:x-oauth-basic" \ | |
https://api.github.com/repos/$owner/$project/pulls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment