mirror of
https://github.com/danog/dart-sass.git
synced 2024-12-11 00:29:41 +01:00
6ea8ce6cf9
The previous implementation contained 2 mistakes: - there was a mismatch between names of env variables in the workflow config and in the script - the `github.base_ref` property in github actions contains a branch name, not a full git ref like `github.ref`
43 lines
1.0 KiB
Bash
Executable File
43 lines
1.0 KiB
Bash
Executable File
#!/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
|
|
# master.
|
|
|
|
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=master
|
|
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
|