Skip to content

Commit e3f2fdc

Browse files
authored
fix: log extraction only if debug is enabled (#21)
* fix: silence tar extraction * fix: log if debug is enabled Signed-off-by: Nuno Pires <nuno.pires@nexthink.com> * fix: abstract Signed-off-by: Nuno Pires <nuno.pires@nexthink.com> * fix: debug func Signed-off-by: Nuno Pires <nuno.pires@nexthink.com> --------- Signed-off-by: Nuno Pires <nuno.pires@nexthink.com>
1 parent f067f95 commit e3f2fdc

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

setup.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22

33
set -euo pipefail
44

5+
# Function to run commands only in debug mode
6+
debug() {
7+
if [[ "${RUNNER_DEBUG:-0}" == "1" ]]; then
8+
"$@" | sed 's/^/DEBUG: /g'
9+
fi
10+
}
11+
512
# Enable debug mode if RUNNER_DEBUG is 1
6-
[[ "${RUNNER_DEBUG:-0}" == "1" ]] && set -x
13+
debug set -x
714

815
# Function to print error and exit
916
error() {
@@ -121,10 +128,11 @@ else
121128

122129
if [[ "${ASSET_NAME}" == *.zip ]]; then
123130
info "Extracting ${ASSET_NAME}"
131+
debug unzip -l "${ASSET_NAME}"
124132
unzip -q "${ASSET_NAME}"
125133
elif [[ "${ASSET_NAME}" == *.tar.gz ]]; then
126134
info "Extracting ${ASSET_NAME}"
127-
tar tzf "${ASSET_NAME}"
135+
debug tar tzf "${ASSET_NAME}"
128136
tar xzf "${ASSET_NAME}"
129137
fi
130138

0 commit comments

Comments
 (0)