Skip to content

Instantly share code, notes, and snippets.

@ecarreras
Last active October 8, 2015 19:28
Show Gist options
  • Save ecarreras/3378527 to your computer and use it in GitHub Desktop.
Save ecarreras/3378527 to your computer and use it in GitHub Desktop.
Make a github issue from a created branch
#!/bin/bash
d_repo=( $(git remote -v | grep '\(push\)' | cut -d':' -f 2 | \
cut -d' ' -f 1 | cut -d '.' -f 1) )
d_base="developer"
d_from=gisce:$(git branch --no-color 2> /dev/null | grep '^\*' | \
cut -d ' ' -f 2)
read -p "User:" user
read -sp "Password:" password
echo
if [ ${#d_repo[@]} -gt 1 ] ;
then
echo "Available repos: '${d_repo[*]}' "
fi
read -p "Dest repo (${d_repo[0]}): " repo
if [ "x" == "x$repo" ]; then repo=$d_repo; fi
read -p "Dest branch ($d_base): " base
if [ "x" == "x$base" ]; then base=$d_base; fi
read -p "From branch ($d_from): " from
if [ "x" == "x$from" ]; then from=$d_from; fi
read -p "Issue:" issue
http -a $user:$password -j POST https://api.github.com/repos/$repo/pulls \
base=$base head=$from issue=$issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment