From 779371b0c691ee5955af1614af97fd7b99afa130 Mon Sep 17 00:00:00 2001 From: lnk3 Date: Tue, 30 Jul 2024 12:32:19 +0200 Subject: [PATCH] fix: checking version was too strict check_version now doesn't fail when `tool` has version `0.X` and `threshold` is set to `0.X.0` --- gh-notify | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gh-notify b/gh-notify index dfb78d8..984a9e6 100755 --- a/gh-notify +++ b/gh-notify @@ -627,6 +627,10 @@ check_version() { IFS='.' read -ra threshold_parts <<<"$threshold" for i in "${!threshold_parts[@]}"; do + # If the threshold's last part is 0 and version has one less parts, it's ok + if (( i == ${#threshold_parts[@]} - 1 )) && ((${#ver_parts[@]} == ${#threshold_parts[@]} - 1)) && ((${threshold_parts[i]} == 0)); then + break + fi if ((i >= ${#ver_parts[@]})) || ((ver_parts[i] < threshold_parts[i])); then $on_error "Your '$tool' version '$user_version' is insufficient. The minimum required version is '$threshold'." elif ((ver_parts[i] > threshold_parts[i])); then