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 22, 2018
1 parent 987aa68 commit c75bb8d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
sudo: false
language: ruby
cache: bundler

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
10 changes: 9 additions & 1 deletion extra/sass-spec-ref.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ 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
>&2 echo "Fetching pull request info without authentication"
JSON=$(curl -L -sS $url)
else
>&2 echo "Fetching pull request info as sassbot"
JSON=$(curl -u "sassbot:$GITHUB_AUTH" -L -sS $url)
fi
>&2 echo "$JSON"

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

Expand Down

0 comments on commit c75bb8d

Please sign in to comment.