Skip to content
This repository has been archived by the owner on Apr 4, 2019. It is now read-only.

Commit

Permalink
Fetch the pull request number using @sassbot's credentials
Browse files Browse the repository at this point in the history
This avoids running into GitHub's low rate limits for unauthenticated
requests.
  • Loading branch information
nex3 committed Jun 21, 2018
1 parent d68bc31 commit 0199a8c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
14 changes: 12 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
sudo: false
language: ruby
cache: bundler

env:
global:
# GITHUB_AUTH="..."
#
# Used to fetch the corresponding sass-spec ref without running into GitHub's
# API rate limit.
- secure: "DSINT3LH/FaoSfYEo7kyRBilEWtAoGjZ6TJgwawmkeV8uhiOo/PbrulHMlQJszH0zOk5h8d8CD9fwtOTlItSzbLJaGyF7MQN3SwqJ5+UIzZio3znGA+TR0jEKY2
uaF06qa42f9szyd40aszYeYQDA6jTkS3reM0LL0oOwA6GY7Q="

install:
# If we're running for a pull request, check out the revision of sass-spec
# referenced by that pull request.
- |
if [ ! -z "$TRAVIS_PULL_REQUEST" -a "$TRAVIS_PULL_REQUEST" != false ]; then
ref=$(extra/sass-spec-ref.sh)
mkdir sass-spec
git -C sass-spec init
git -C sass-spec pull --depth=1 git://github.com/sass/sass-spec \
$(extra/sass-spec-ref.sh)
git -C sass-spec pull --depth=1 git://github.com/sass/sass-spec "$ref"
bundle config local.sass-spec "$(pwd)/sass-spec"
fi
Expand Down
7 changes: 6 additions & 1 deletion extra/sass-spec-ref.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ fi

>&2 echo "Fetching pull request $TRAVIS_PULL_REQUEST..."

JSON=$(curl -L -sS https://api.github.com/repos/sass/sass/pulls/$TRAVIS_PULL_REQUEST)
url=https://api.github.com/repos/sass/sass/pulls/$TRAVIS_PULL_REQUEST
if [ -z "$GITHUB_AUTH" ]; then
JSON=$(curl -L -sS $url)
else
JSON=$(curl -u "sassbot:$GITHUB_AUTH" -L -sS $url)
fi

RE_SPEC_PR="sass\/sass-spec(#|\/pull\/)([0-9]+)"

Expand Down

0 comments on commit 0199a8c

Please sign in to comment.