Skip to content

Instantly share code, notes, and snippets.

@florinel-chis
Created August 8, 2013 15:30
Show Gist options
  • Save florinel-chis/6185656 to your computer and use it in GitHub Desktop.
Save florinel-chis/6185656 to your computer and use it in GitHub Desktop.
Shell script to retrieve the patch file for a pull request in a private repo on github
#!/bin/bash
usage()
{
cat << EOF
usage: $0 pull_id
pull_id needs to be a number
EOF
}
if [ -z "$1" ]
then
usage
exit 1
fi
PULL_ID=$1
cwd=$(pwd)
TOKEN="YOUR_TOKEN_HERE"
curl -H "Authorization: token $TOKEN" -H "Accept: application/vnd.github.v3.patch" https://api.github.com/repos/user/repo/pulls/$PULL_ID > $cwd/patches/$PULL_ID.patch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment