From 3fb1c3467ceb660d507c27d14291e96655931e19 Mon Sep 17 00:00:00 2001 From: Marco Ferrari Date: Wed, 10 Jan 2024 10:06:04 +0100 Subject: [PATCH] feat: delete temporary files and directories (#5046) - Delete logback.log - Delete .lintr if super-linter created it --- lib/linter.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index b1eaefba..85ad4966 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -826,6 +826,16 @@ UpdateLoopsForImage() { # shellcheck disable=SC2317 cleanup() { local -ri EXIT_CODE=$? + + debug "Removing temporary files and directories" + rm -rfv \ + "${GITHUB_WORKSPACE}/logback.log" + + if [ "${SUPER_LINTER_COPIED_R_LINTER_RULES_FILE}" == "true" ]; then + debug "Deleting ${R_RULES_FILE_PATH_IN_ROOT} because super-linter created it." + rm -rfv "${R_RULES_FILE_PATH_IN_ROOT}" + fi + # Define this variable here so we can rely on it as soon as possible local LOG_FILE_PATH="${GITHUB_WORKSPACE}/${LOG_FILE}" debug "LOG_FILE_PATH: ${LOG_FILE_PATH}" @@ -886,6 +896,9 @@ ConfigureGitSafeDirectories TYPESCRIPT_STANDARD_TSCONFIG_FILE="${GITHUB_WORKSPACE}/${TYPESCRIPT_STANDARD_TSCONFIG_FILE:-"tsconfig.json"}" 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}" + ############################ # Validate the environment # ############################ @@ -1097,9 +1110,11 @@ for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do debug "No .editorconfig found at: $EDITORCONFIG_FILE_PATH. Skipping ${LANGUAGE} linting..." continue fi - elif [ "${LANGUAGE}" = "R" ] && [ ! -f "${GITHUB_WORKSPACE}/.lintr" ] && ((${#FILE_ARRAY_R[@]})); then + elif [ "${LANGUAGE}" = "R" ] && [ ! -f "${R_RULES_FILE_PATH_IN_ROOT}" ] && ((${#FILE_ARRAY_R[@]})); then info "No .lintr configuration file found, using defaults." cp "$R_LINTER_RULES" "$GITHUB_WORKSPACE" + # shellcheck disable=SC2034 + SUPER_LINTER_COPIED_R_LINTER_RULES_FILE="true" # Check if there's local configuration for the Raku linter elif [ "${LANGUAGE}" = "RAKU" ] && [ -e "${GITHUB_WORKSPACE}/META6.json" ]; then cd "${GITHUB_WORKSPACE}" && zef install --deps-only --/test .