Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vojtech-dobes/2972475 to your computer and use it in GitHub Desktop.
Save vojtech-dobes/2972475 to your computer and use it in GitHub Desktop.
Add pull request to existing issue on github
#!/bin/bash
current_branch="$(git symbolic-ref HEAD 2>/dev/null)" || current_branch="(unknown)"
current_branch=${current_branch##refs/heads/}
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:"
read base
echo "GitHub username:"
read username
echo "GitHub password:"
read password
curl \
-d "{ \"base\": \"$base\", \"head\": \"$owner:$current_branch\", \"issue\": \"$issue\"}" \
-u "$username:$password" \
https://api.github.com/repos/$owner/$project/pulls
@Majkl578
Copy link

Majkl578 commented Aug 1, 2013

$owner:$current_branch should actually be $username:$current_branch (where $username stands for user being bulled from).

@vojtech-dobes
Copy link
Author

@Majkl578 what do you exactly mean?

@JanTvrdik
Copy link

@Majkl578 is right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment