2022-12-15 09:27:04 +00:00

36 lines
1.4 KiB
Bash

# Note no #!/bin/sh as this should not spawn
# an extra shell, since this partial shell script
# is supposed to be invoked as part of another.
# ===========================================================================
# Flag for overwrite the affected projects calculation
# ===========================================================================
# Usage:
# This flag is intended to be used only for debugging purposes!!!
#
# To run only a few projects, provide a valid list of comma separated projects
# git commit -m "[affected:project-name1,project-name2] you commit message"
#
# ---------------------------------------------------------------
# Affected projects calculation
# ---------------------------------------------------------------
if [[ $COMMIT_MESSAGE == *"[affected:"* ]]; then
PROJECTS=$(echo "$COMMIT_MESSAGE" | grep -o "\[affected\:[^]]*\]" | sed -e 's#\[affected:##g' | sed -e 's#\]##g')
if [[ $PROJECTS == "*" ]]; then
export NX_CALCULATION_FLAGS="--all"
fi
fi
# ---------------------------------------------------------------
# Forced CI run
# ---------------------------------------------------------------
if [[ $COMMIT_MESSAGE == *"[ci:force]"* ]]; then
echo -e "\e[31mWarning: CI build is going to run regardless of its Draft and approval status. You must be a Jedi!\e[0m"
export CI_FORCE_RUN=true
else
export CI_FORCE_RUN=false
fi