Skip to content

Instantly share code, notes, and snippets.

@michaeltchapman
Last active April 5, 2016 18:32
Show Gist options
  • Save michaeltchapman/ccaca317355e65dd32e5b6c1769f126e to your computer and use it in GitHub Desktop.
Save michaeltchapman/ccaca317355e65dd32e5b6c1769f126e to your computer and use it in GitHub Desktop.
#!/bin/bash
pr_number=$(git log -1 | grep 'opnfv-tht-pr:' | grep -o '[0-9]*')
ref="stable/brahmaputra"
repo="https://github.com/trozet/opnfv-tht"
if [ "$PR_NUMBER" != "" ]; then
# TODO source credentials
# source ~/.githubcreds
pr=$(curl https://api.github.com/repos/trozet/opnfv-tht/pulls/$pr_number)
ref=$(echo $pr | python -c "import sys,json; print json.load(sys.stdin)['head']['ref']")
repo=$(echo $pr | python -c "import sys,json; print json.load(sys.stdin)['head']['repo']['git_url']")
fi
git clone $repo -b $ref
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment