diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3e1550c..ce6e5df4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: git -C sass-spec checkout FETCH_HEAD env: PR_BRANCH: "${{ github.base_ref }}" - CURRENT_BRANCH: "${{ github.ref }}" + CURRENT_REF: "${{ github.ref }}" PR_BODY: "${{ github.event.pull_request.body }}" - uses: ruby/setup-ruby@v1 with: diff --git a/tool/github-action/sass-spec-ref.sh b/tool/github-action/sass-spec-ref.sh index 654f77c2..192d5e25 100755 --- a/tool/github-action/sass-spec-ref.sh +++ b/tool/github-action/sass-spec-ref.sh @@ -8,15 +8,21 @@ # sass-spec pull request, we'll run against the latter rather than sass-spec # master. -GITHUB_REF=${PR_REF:-$CURRENT_REF} -if [[ "$GITHUB_REF" == refs/heads/feature.* ]]; then - default="${GITHUB_REF:11}" +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_REF so we are not in a pull request -if [ "$GITHUB_REF" == "$CURRENT_REF" ]; then +# 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