Skip to content

Instantly share code, notes, and snippets.

@paulserraino
Last active November 11, 2015 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulserraino/281926e8feb9a6f8e0e2 to your computer and use it in GitHub Desktop.
Save paulserraino/281926e8feb9a6f8e0e2 to your computer and use it in GitHub Desktop.
automating my goodybag review process
#!/usr/bin/env bash
# ./review.sh [branch id]
#example.
# ./review.sh 1947
if [ "$GITHUB_TOKEN" == "" ] ; then
echo "Error! You need to set GITHUB_TOKEN environment variable!"
exit 1
fi
github="https://${GITHUB_TOKEN}:x-oauth-basic@api.github.com/repos/goodybag/cater-api-server/pulls/$1"
branch=$(curl $github | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["head"]["ref"]')
if [ `git branch --list $branch` ] ; then
git checkout $branch
else
git checkout -b $branch
fi
git pull origin $branch
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment