Last active
April 5, 2016 18:32
-
-
Save michaeltchapman/ccaca317355e65dd32e5b6c1769f126e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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