diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 208cb7dfb..045549595 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,12 +36,9 @@ jobs: - uses: dart-lang/setup-dart@v1 with: {sdk: "${{ matrix.dart_channel }}"} - run: dart pub get - - name: Set up sass-spec - run: tool/github-action/check-out-sass-spec.sh - env: - PR_BRANCH: "${{ github.base_ref }}" - CURRENT_REF: "${{ github.ref }}" - PR_BODY: "${{ github.event.pull_request.body }}" + - name: Check out sass-spec + uses: sass/clone-linked-repo@v1 + with: {repo: sass/sass-spec} - uses: actions/setup-node@v2 with: {node-version: "${{ env.DEFAULT_NODE_VERSION }}"} - run: npm install @@ -86,11 +83,8 @@ jobs: - run: npm install - name: Check out sass-spec - run: tool/github-action/check-out-sass-spec.sh - env: - PR_BRANCH: "${{ github.base_ref }}" - CURRENT_REF: "${{ github.ref }}" - PR_BODY: "${{ github.event.pull_request.body }}" + uses: sass/clone-linked-repo@v1 + with: {repo: sass/sass-spec} - name: Build JS run: dart pub run grinder pkg-npm-dev @@ -100,7 +94,10 @@ jobs: working-directory: sass-spec - name: Check out Sass specification - run: git clone https://github.com/sass/sass.git language --depth 1 + uses: sass/clone-linked-repo@v1 + with: + repo: sass/sass + path: language - name: Run tests run: npm run js-api-spec -- --sassSassRepo ../language diff --git a/lib/src/importer/node_to_dart/async_file.dart b/lib/src/importer/node_to_dart/async_file.dart index 47949bf81..8fa31c915 100644 --- a/lib/src/importer/node_to_dart/async_file.dart +++ b/lib/src/importer/node_to_dart/async_file.dart @@ -47,9 +47,7 @@ class NodeToDartAsyncFileImporter extends AsyncImporter { '"$url".')); } - var canonical = _filesystemImporter.canonicalize(resultUrl); - if (canonical == null) return null; - return canonical; + return _filesystemImporter.canonicalize(resultUrl); } ImporterResult? load(Uri url) => _filesystemImporter.load(url); diff --git a/lib/src/importer/node_to_dart/file.dart b/lib/src/importer/node_to_dart/file.dart index e8033e91a..45b66d75c 100644 --- a/lib/src/importer/node_to_dart/file.dart +++ b/lib/src/importer/node_to_dart/file.dart @@ -35,7 +35,7 @@ class NodeToDartFileImporter extends Importer { if (isPromise(result)) { jsThrow(JsError( - "The canonicalize() function can't return a Promise for synchronous " + "The findFileUrl() function can't return a Promise for synchron " "compile functions.")); } else if (!isJSUrl(result)) { jsThrow(JsError("The findFileUrl() method must return a URL.")); @@ -48,9 +48,7 @@ class NodeToDartFileImporter extends Importer { '"$url".')); } - var canonical = _filesystemImporter.canonicalize(resultUrl); - if (canonical == null) return null; - return canonical; + return _filesystemImporter.canonicalize(resultUrl); } ImporterResult? load(Uri url) => _filesystemImporter.load(url); diff --git a/tool/github-action/check-out-sass-spec.sh b/tool/github-action/check-out-sass-spec.sh deleted file mode 100755 index 8dd941df3..000000000 --- a/tool/github-action/check-out-sass-spec.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/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