diff --git a/lib/linter.sh b/lib/linter.sh index 2d5005af..8bec30fd 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -129,6 +129,17 @@ YAML_ERROR_ON_WARNING="${YAML_ERROR_ON_WARNING:-false}" declare -l SAVE_SUPER_LINTER_SUMMARY SAVE_SUPER_LINTER_SUMMARY="${SAVE_SUPER_LINTER_SUMMARY:-false}" +# Define private output paths early because cleanup depends on those being defined +DEFAULT_SUPER_LINTER_OUTPUT_DIRECTORY_NAME="super-linter-output" +SUPER_LINTER_OUTPUT_DIRECTORY_NAME="${SUPER_LINTER_OUTPUT_DIRECTORY_NAME:-${DEFAULT_SUPER_LINTER_OUTPUT_DIRECTORY_NAME}}" +export SUPER_LINTER_OUTPUT_DIRECTORY_NAME +debug "Super-linter main output directory name: ${SUPER_LINTER_OUTPUT_DIRECTORY_NAME}" + +SUPER_LINTER_PRIVATE_OUTPUT_DIRECTORY_PATH="/tmp/${DEFAULT_SUPER_LINTER_OUTPUT_DIRECTORY_NAME}" +export SUPER_LINTER_PRIVATE_OUTPUT_DIRECTORY_PATH +debug "Super-linter private output directory path: ${SUPER_LINTER_PRIVATE_OUTPUT_DIRECTORY_PATH}" +mkdir -p "${SUPER_LINTER_PRIVATE_OUTPUT_DIRECTORY_PATH}" + ValidateBooleanConfigurationVariables ########### @@ -706,7 +717,7 @@ cleanup() { debug "Moving Super-linter output from ${SUPER_LINTER_PRIVATE_OUTPUT_DIRECTORY_PATH} to ${SUPER_LINTER_OUTPUT_DIRECTORY_PATH}" mv "${SUPER_LINTER_PRIVATE_OUTPUT_DIRECTORY_PATH}" "${SUPER_LINTER_OUTPUT_DIRECTORY_PATH}" else - debug "Skip moving the output directory from ${SUPER_LINTER_PRIVATE_OUTPUT_DIRECTORY_PATH} to ${SUPER_LINTER_OUTPUT_DIRECTORY_PATH}" + debug "Skip moving the private Super-linter output directory (${SUPER_LINTER_PRIVATE_OUTPUT_DIRECTORY_PATH}) to the output directory (${SUPER_LINTER_OUTPUT_DIRECTORY_PATH:-"not initialized yet"})" fi else @@ -757,11 +768,6 @@ debug "TYPESCRIPT_STANDARD_TSCONFIG_FILE: ${TYPESCRIPT_STANDARD_TSCONFIG_FILE}" R_RULES_FILE_PATH_IN_ROOT="${GITHUB_WORKSPACE}/${R_FILE_NAME}" debug "R_RULES_FILE_PATH_IN_ROOT: ${R_RULES_FILE_PATH_IN_ROOT}" -DEFAULT_SUPER_LINTER_OUTPUT_DIRECTORY_NAME="super-linter-output" -SUPER_LINTER_OUTPUT_DIRECTORY_NAME="${SUPER_LINTER_OUTPUT_DIRECTORY_NAME:-${DEFAULT_SUPER_LINTER_OUTPUT_DIRECTORY_NAME}}" -export SUPER_LINTER_OUTPUT_DIRECTORY_NAME -debug "Super-linter main output directory name: ${SUPER_LINTER_OUTPUT_DIRECTORY_NAME}" - SUPER_LINTER_MAIN_OUTPUT_DIRECTORY_PATH="${GITHUB_WORKSPACE}/${SUPER_LINTER_OUTPUT_DIRECTORY_NAME}" export SUPER_LINTER_MAIN_OUTPUT_DIRECTORY_PATH debug "Super-linter main output directory path: ${SUPER_LINTER_MAIN_OUTPUT_DIRECTORY_PATH}" @@ -770,11 +776,6 @@ SUPER_LINTER_OUTPUT_DIRECTORY_PATH="${SUPER_LINTER_MAIN_OUTPUT_DIRECTORY_PATH}/s export SUPER_LINTER_OUTPUT_DIRECTORY_PATH debug "Super-linter output directory path: ${SUPER_LINTER_OUTPUT_DIRECTORY_PATH}" -SUPER_LINTER_PRIVATE_OUTPUT_DIRECTORY_PATH="/tmp/${DEFAULT_SUPER_LINTER_OUTPUT_DIRECTORY_NAME}" -export SUPER_LINTER_PRIVATE_OUTPUT_DIRECTORY_PATH -debug "Super-linter private output directory path: ${SUPER_LINTER_PRIVATE_OUTPUT_DIRECTORY_PATH}" -mkdir -p "${SUPER_LINTER_PRIVATE_OUTPUT_DIRECTORY_PATH}" - SUPER_LINTER_SUMMARY_OUTPUT_PATH="${SUPER_LINTER_MAIN_OUTPUT_DIRECTORY_PATH}/${SUPER_LINTER_SUMMARY_FILE_NAME:-"super-linter-summary.md"}" export SUPER_LINTER_SUMMARY_OUTPUT_PATH debug "Super-linter summary output path: ${SUPER_LINTER_SUMMARY_OUTPUT_PATH}"