From e747a15f2e13eb03dc4dee45b81e9f3fe3d68c5e Mon Sep 17 00:00:00 2001 From: apostolof Date: Sat, 20 Feb 2021 16:11:42 +0200 Subject: [PATCH] fix: add missing concordia prefix to package name directory, account for manual executions in commit range string build --- jenkins/check_package_changed.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) 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[*]})