diff --git a/jenkins/check_package_changed.sh b/jenkins/check_package_changed.sh index b915e37..171e740 100755 --- a/jenkins/check_package_changed.sh +++ b/jenkins/check_package_changed.sh @@ -9,11 +9,23 @@ GIT_COMMIT=$2 GIT_PREVIOUS_COMMIT=$3 ROOT_FILES_AND_FOLDERS=${4:-"package.json" "yarn.lock" ".dockerignore" "docker" "jenkins"} -function join_by { local IFS="$1"; shift; echo "$*"; } +function join_by() { + local IFS="$1" + shift + echo "$*" +} -function package_changed { git diff --name-only "$COMMIT_RANGE" | grep -qE "^packages/$1/" && echo true || echo false; } +function package_changed() { + git diff --name-only "$COMMIT_RANGE" | grep -qE "^packages/concordia-$1/" && echo true || echo false +} + +if [ "$GIT_COMMIT" == "$GIT_PREVIOUS_COMMIT" ]; then + # Probably a manual re-run, set the range to just the last commit + COMMIT_RANGE="$GIT_COMMIT" +else + COMMIT_RANGE="$GIT_PREVIOUS_COMMIT...$GIT_COMMIT" +fi -COMMIT_RANGE="$GIT_PREVIOUS_COMMIT...$GIT_COMMIT" ROOT_FILES_AND_FOLDERS_ARRAY=($ROOT_FILES_AND_FOLDERS) ROOT_FILES_AND_FOLDERS_JOINED=$(join_by "|" ${ROOT_FILES_AND_FOLDERS_ARRAY[*]})