Skip to content

Instantly share code, notes, and snippets.

@JanTvrdik
Last active June 6, 2016 19:25
Show Gist options
  • Save JanTvrdik/2425007 to your computer and use it in GitHub Desktop.
Save JanTvrdik/2425007 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 "Nepodařilo se zjistit aktuální větev!"
exit 1
fi
company="clevisaci"
project="tripilot"
echo "Issue number:"
read issue
echo "Base commit / branch:"
read base
echo "GitHub username:"
read username
echo "GitHub password:"
read password
curl \
-d "pull[base]=$base" \
-d "pull[head]=$company:$current_branch" \
-d "pull[issue]=$issue" \
-u "$username:$password" \
https://github.com/api/v2/json/pulls/$company/$project
@PetrP
Copy link

PetrP commented Apr 20, 2012

HEAD must be on the branch which contains the pull request.

@vojtech-dobes
Copy link

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