-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run shared JS tests from the sass-spec repo (#1486)
- Loading branch information
Showing
3 changed files
with
122 additions
and
59 deletions.
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,47 @@ | ||
#!/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 GitHub | ||
# Actions 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 | ||
# main. | ||
function choose-ref() { | ||
if [ -z "$PR_BRANCH" ]; then | ||
# Remove the "refs/heads/" prefix | ||
current_branch="${CURRENT_REF:11}" | ||
else | ||
current_branch="$PR_BRANCH" | ||
fi | ||
|
||
if [[ "$current_branch" == feature.* ]]; then | ||
default="$current_branch" | ||
else | ||
default=main | ||
fi | ||
|
||
# We don't have a PR_BRANCH so we are not in a pull request | ||
if [ -z "$PR_BRANCH" ]; then | ||
>&2 echo "Ref: $default." | ||
echo "$default" | ||
exit 0 | ||
fi | ||
|
||
>&2 echo "$PR_BODY" | ||
|
||
RE_SPEC_PR="sass/sass-spec(#|/pull/)([0-9]+)" | ||
|
||
if [[ "$PR_BODY" =~ $RE_SPEC_PR ]]; then | ||
ref="pull/${BASH_REMATCH[2]}/head" | ||
>&2 echo "Ref: $ref." | ||
echo "$ref" | ||
else | ||
>&2 echo "Ref: $default." | ||
echo "$default" | ||
fi | ||
} | ||
|
||
git init sass-spec | ||
git -C sass-spec fetch git://github.com/sass/sass-spec "$(choose-ref)" --depth 1 | ||
git -C sass-spec checkout FETCH_HEAD |
This file was deleted.
Oops, something went wrong.