From 9d175ca332b1dbaf36e6b231189e4ff3c17512cf Mon Sep 17 00:00:00 2001 From: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com> Date: Thu, 21 Oct 2021 21:13:32 +0200 Subject: [PATCH] Update assert-changed-files.sh --- scripts/assert-changed-files.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/assert-changed-files.sh b/scripts/assert-changed-files.sh index 2a45a8f650..4f5833cc14 100755 --- a/scripts/assert-changed-files.sh +++ b/scripts/assert-changed-files.sh @@ -21,20 +21,16 @@ if [ "$IS_CI" = true ]; then git config --local --unset url."https://github.com/".insteadOf fi -# Make sure that we are diffing towards the right branch, in github actions this is different -# depending on whether or not we are creating a pull request or not. -[ ! -z ${GITHUB_BASE_REF} ] && HAS_BASE=true || HAS_BASE=false -[ HAS_BASE = true ] && COMPARE="${GITHUB_BASE_REF#refs/heads/}" || COMPARE="develop" -FILES_COUNT="$(git diff-tree --no-commit-id --name-only -r origin/"$COMPARE" | grep -E "$GREP_PATTERN" -c)" +FILES_COUNT="$(git diff-tree --no-commit-id --name-only -r "$CIRCLE_BRANCH" origin/master | grep -E "$GREP_PATTERN" -c)" if [ "$IS_CI" = true ]; then # reset to previous state - git reset --hard $GITHUB_SHA + git reset --hard $CIRCLE_SHA1 fi if [ "$FILES_COUNT" -eq 0 ]; then echo "0 files matching '$GREP_PATTERN'; exiting and marking successful." - exit 1 + circleci step halt || exit 1 else echo "$FILES_COUNT file(s) matching '$GREP_PATTERN'; continuing." fi