Skip to content

Commit

Permalink
feat: delete temporary files and directories (#5046)
Browse files Browse the repository at this point in the history
- Delete logback.log
- Delete .lintr if super-linter created it
  • Loading branch information
ferrarimarco committed Jan 10, 2024
1 parent 2d79d17 commit 3fb1c34
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lib/linter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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 #
############################
Expand Down Expand Up @@ -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 .
Expand Down

0 comments on commit 3fb1c34

Please sign in to comment.