You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
oh-my-fish/tools/travis-github-pr-integratio...

18 lines
636 B
Bash

# Return if we are not in a Pull Request
if [[ "$TRAVIS_PULL_REQUEST" = "false" ]]; then
export OMF_REPO_URI="https://github.com/$TRAVIS_REPO_SLUG"
export OMF_REPO_BRANCH="$TRAVIS_BRANCH"
return
fi
GITHUB_PR_URL=https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/$TRAVIS_PULL_REQUEST
GITHUB_PR_BODY=$(curl -s $GITHUB_PR_URL 2>/dev/null)
if [[ $GITHUB_PR_BODY =~ \"ref\":\ *\"([a-zA-Z0-9_-]*)\" ]]; then
export OMF_REPO_BRANCH=${BASH_REMATCH[1]}
fi
if [[ $GITHUB_PR_BODY =~ \"repo\":.*\"clone_url\":\ *\"(https://github\.com/[a-zA-Z0-9_-]*/[a-zA-Z0-9_-]*\.git).*\"base\" ]]; then
export OMF_REPO_URI=${BASH_REMATCH[1]}
fi