Skip to content

Instantly share code, notes, and snippets.

@AntonTyutin
Created June 16, 2014 14:26
Show Gist options
  • Save AntonTyutin/483f6148592f78f7fcdb to your computer and use it in GitHub Desktop.
Save AntonTyutin/483f6148592f78f7fcdb to your computer and use it in GitHub Desktop.
Attach GitHub pull-request to an existent issue
#!/bin/bash
API_TOKEN="~"
NL="
"
NL2="$NL$NL"
HELP="$NL2 Usage: $0 vendor/repo feature_branch 15$NL"
REPO=${1:?"$NL2 A repository name (vendor/repo) must be specified.$HELP"}
HEAD=${2:?"$NL2 A branch name must be specified.$HELP"}
ISSUE=${3:?"$NL2 An issue id must be specified.$HELP"}
BASE=${4:-'master'}
curl \
-H "Authorization: token $API_TOKEN" \
--request POST \
--data "{\"issue\": \"$ISSUE\", \"head\": \"$HEAD\", \"base\": \"$BASE\"}" \
"https://api.github.com/repos/$REPO/pulls"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment