Skip to content

Commit

Permalink
Allow pull requests to skip an implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Jan 7, 2017
1 parent 42ee515 commit c31b280
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ matrix:
- env: LANGUAGE_VERSION=4.0 IMPL=dart-sass

before_install:
- if ./tools/skipped-for-impl.sh; then exit 0; fi
- rm Gemfile.lock

- if [ $IMPL == "libsass" ]; then
Expand Down
26 changes: 26 additions & 0 deletions tools/skipped-for-impl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash -e

# Exits with exit code 0 if the tests should be skipped for the current
# implementation, and exit code 1 otherwise. This allows pull requests to
# include e.g. "Skip dart-sass" if a connected Dart Sass pull request is also in
# flight. Multiple implementations can also be skipped: "Skip libsass,
# ruby-sass".

if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
>&2 echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST."
>&2 echo "Not skipping."
exit 1
fi

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

JSON=$(curl -L -sS https://api.github.com/repos/sass/sass-spec/pulls/$TRAVIS_PULL_REQUEST)

RE_SKIP="[Ss]kip\>[a-z, -]*\<$IMPL"

if [[ $JSON =~ $RE_SPEC_PR && "${BASH_REMATCH[2]}" == "$IMPL" ]]; then
>&2 echo "Skipping $IMPL."
exit 0
else
exit 1
fi

0 comments on commit c31b280

Please sign in to comment.