This repository was archived by the owner on Feb 20, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed 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+ echo $GITHUB_PR_BODY
9+
10+ if [[ $GITHUB_PR_BODY =~ \" ref\" :\ * \" ([a-zA-Z0-9_-]* )\" ]]; then
11+ export TRAVIS_PR_BRANCH=${BASH_REMATCH[1]}
12+ echo $TRAVIS_PR_BRANCH
13+ else
14+ return
15+ fi
16+
17+ GITHUB_BRANCH_URL=https://api.github.com/repos/$TRAVIS_REPO_SLUG /branches/$TRAVIS_PR_BRANCH
18+ echo $GITHUB_BRANCH_URL
19+ if [ $( curl -s --head --request GET $GITHUB_BRANCH_URL | grep " 200 OK" > /dev/null) ]; then
20+ TRAVIS_BRANCH=$TRAVIS_PR_BRANCH
21+ echo $TRAVIS_BRANCH
22+ if [[ $GITHUB_PR_BODY =~ \" repo\" :.* \" clone_url\" :\ * \" https://github\. com/([a-zA-Z0-9_-]* /[a-zA-Z0-9_-]* )\. git.* \" base\" ]]; then
23+ export TRAVIS_REPO_SLUG=${BASH_REMATCH[1]}
24+ fi
25+ fi
You can’t perform that action at this time.
0 commit comments