This repository was archived by the owner on Feb 20, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88 - 7.0
99
1010before_install :
11+ - source tests/travis-github-pr-integration.sh
1112 - if [ -f .git/shallow ]; then rm .git/shallow; fi
1213 - composer install
1314 - composer require --prefer-source --dev squizlabs/php_codesniffer:~2.0
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # Return if we are not in a Pull Request
4+ [[ " $TRAVIS_PULL_REQUEST " = " false" ]] && return
5+
6+ GITHUB_PR_URL=https://api.github.com/repos/$TRAVIS_REPO_SLUG /pulls/$TRAVIS_PULL_REQUEST
7+ GITHUB_PR_BODY=$( curl -s $GITHUB_PR_URL 2> /dev/null)
8+
9+ if [[ $GITHUB_PR_BODY =~ \" ref\" :\ * \" ([a-zA-Z0-9_-]* )\" ]]; then
10+ export TRAVIS_PR_BRANCH=${BASH_REMATCH[1]}
11+ else
12+ return
13+ fi
14+
15+ GITHUB_BRANCH_URL=https://api.github.com/repos/$TRAVIS_REPO_SLUG /branches/$TRAVIS_PR_BRANCH
16+ if [ $( curl -s --head --request GET $GITHUB_BRANCH_URL | grep " 200 OK" > /dev/null) ]; then
17+ TRAVIS_BRANCH=$TRAVIS_PR_BRANCH
18+ if [[ $GITHUB_PR_BODY =~ \" repo\" :.* \" clone_url\" :\ * \" https://github\. com/([a-zA-Z0-9_-]* /[a-zA-Z0-9_-]* )\. git.* \" base\" ]]; then
19+ export TRAVIS_REPO_SLUG=${BASH_REMATCH[1]}
20+ fi
21+ fi
You can’t perform that action at this time.
0 commit comments