Skip to content

Commit

Permalink
fix: checking version was too strict
Browse files Browse the repository at this point in the history
check_version now doesn't fail when `tool` has version `0.X` and `threshold` is set to `0.X.0`
  • Loading branch information
lnk3 committed Jul 30, 2024
1 parent 55ea798 commit 779371b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gh-notify
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 779371b

Please sign in to comment.