From 1ec7c2a0df11ecd0f16aac559748bbab6f0395a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Sun, 22 Dec 2024 13:51:51 +0100 Subject: [PATCH] fix: comparing against a missing value If a new package was added, the action would fail as it would try to subtract `null` from an integer. Instead default to `0`. --- compare.jq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compare.jq b/compare.jq index 326b4de..88a366e 100644 --- a/compare.jq +++ b/compare.jq @@ -2,7 +2,7 @@ # # Where .[0] is the new value, and .[1] is the old value def calc_change($key): - . as $input | $input[0][$key] - $input[1][$key]; + . as $input | ($input[0][$key] // 0) - ($input[1][$key] // 0); # Calculate the change in percentage for multiple keys #