Skip to content

Commit 3fb1c34

Browse files
authored
feat: delete temporary files and directories (#5046)
- Delete logback.log - Delete .lintr if super-linter created it
1 parent 2d79d17 commit 3fb1c34

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

lib/linter.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,16 @@ UpdateLoopsForImage() {
826826
# shellcheck disable=SC2317
827827
cleanup() {
828828
local -ri EXIT_CODE=$?
829+
830+
debug "Removing temporary files and directories"
831+
rm -rfv \
832+
"${GITHUB_WORKSPACE}/logback.log"
833+
834+
if [ "${SUPER_LINTER_COPIED_R_LINTER_RULES_FILE}" == "true" ]; then
835+
debug "Deleting ${R_RULES_FILE_PATH_IN_ROOT} because super-linter created it."
836+
rm -rfv "${R_RULES_FILE_PATH_IN_ROOT}"
837+
fi
838+
829839
# Define this variable here so we can rely on it as soon as possible
830840
local LOG_FILE_PATH="${GITHUB_WORKSPACE}/${LOG_FILE}"
831841
debug "LOG_FILE_PATH: ${LOG_FILE_PATH}"
@@ -886,6 +896,9 @@ ConfigureGitSafeDirectories
886896
TYPESCRIPT_STANDARD_TSCONFIG_FILE="${GITHUB_WORKSPACE}/${TYPESCRIPT_STANDARD_TSCONFIG_FILE:-"tsconfig.json"}"
887897
debug "TYPESCRIPT_STANDARD_TSCONFIG_FILE: ${TYPESCRIPT_STANDARD_TSCONFIG_FILE}"
888898

899+
R_RULES_FILE_PATH_IN_ROOT="${GITHUB_WORKSPACE}/${R_FILE_NAME}"
900+
debug "R_RULES_FILE_PATH_IN_ROOT: ${R_RULES_FILE_PATH_IN_ROOT}"
901+
889902
############################
890903
# Validate the environment #
891904
############################
@@ -1097,9 +1110,11 @@ for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
10971110
debug "No .editorconfig found at: $EDITORCONFIG_FILE_PATH. Skipping ${LANGUAGE} linting..."
10981111
continue
10991112
fi
1100-
elif [ "${LANGUAGE}" = "R" ] && [ ! -f "${GITHUB_WORKSPACE}/.lintr" ] && ((${#FILE_ARRAY_R[@]})); then
1113+
elif [ "${LANGUAGE}" = "R" ] && [ ! -f "${R_RULES_FILE_PATH_IN_ROOT}" ] && ((${#FILE_ARRAY_R[@]})); then
11011114
info "No .lintr configuration file found, using defaults."
11021115
cp "$R_LINTER_RULES" "$GITHUB_WORKSPACE"
1116+
# shellcheck disable=SC2034
1117+
SUPER_LINTER_COPIED_R_LINTER_RULES_FILE="true"
11031118
# Check if there's local configuration for the Raku linter
11041119
elif [ "${LANGUAGE}" = "RAKU" ] && [ -e "${GITHUB_WORKSPACE}/META6.json" ]; then
11051120
cd "${GITHUB_WORKSPACE}" && zef install --deps-only --/test .

0 commit comments

Comments
 (0)