-
Notifications
You must be signed in to change notification settings - Fork 352
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fetch a connected sass-spec pull request.
- Loading branch information
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash -e | ||
# Copyright 2016 Google Inc. Use of this source code is governed by an MIT-style | ||
# license that can be found in the LICENSE file or at | ||
# https://opensource.org/licenses/MIT. | ||
|
||
# Echoes the sass-spec Git ref that should be checked out for the current Travis | ||
# run. If we're running specs for a pull request which refers to a sass-spec | ||
# pull request, we'll run against the latter rather than sass-spec master. | ||
|
||
default=dart-sass | ||
|
||
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then | ||
>&2 echo "Ref: $default." | ||
echo "$default" | ||
fi | ||
|
||
>&2 echo "Fetching pull request $TRAVIS_PULL_REQUEST..." | ||
|
||
JSON=$(curl -L -sS https://api.github.com/repos/sass/dart-sass/pulls/$TRAVIS_PULL_REQUEST) | ||
|
||
RE_SPEC_PR="sass\/sass-spec(#|\/pull\/)([0-9]+)" | ||
|
||
if [[ $JSON =~ $RE_SPEC_PR ]]; then | ||
ref="pull/${BASH_REMATCH[2]}/head" | ||
>&2 echo "Ref: $ref." | ||
echo "$ref" | ||
else | ||
>&2 echo "Ref: $default." | ||
echo "$default" | ||
fi |