Skip to content

Commit 351ed98

Browse files
committed
chore: fix issue with numfmt and negative numbers
1 parent ace0d93 commit 351ed98

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

.github/actions/container-size-diff/container-size-diff.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ set -Eeuo pipefail
55
FROM_CONTAINER=${1:?}
66
TO_CONTAINER=${2:?}
77

8+
format_size() {
9+
local SIZE=${1:?}
10+
11+
numfmt --to iec --format '%.2f' -- "${size}"
12+
}
13+
814
get_sizes_from_manifest() {
915
local CONTAINER=${1:?}
1016
declare -Ag ${2:?}
@@ -60,5 +66,5 @@ do
6066
ICON="🔄"
6167
fi
6268

63-
echo "| ${PLATFORM} | $(numfmt --to iec --format '%.2f' ${FROM_SIZE}) | $(numfmt --to iec --format '%.2f' ${TO_SIZE}) | $(numfmt --to iec --format '%.2f' ${DELTA}) (${PERCENT_CHANGE}%) | ${ICON} |"
69+
echo "| ${PLATFORM} | $(format_size ${FROM_SIZE}) | $(format_size ${TO_SIZE}) | $(format_size ${DELTA}) (${PERCENT_CHANGE}%) | ${ICON} |"
6470
done

0 commit comments

Comments
 (0)