Skip to content

Commit

Permalink
filter only supported differential-shellcheck versions
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoberezhniy committed May 6, 2024
1 parent 12c060a commit 1c7171e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
26 changes: 24 additions & 2 deletions autoupdate
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,33 @@ fetch_tags() {
sort -V
}

is_supported_version() {
[[ $# -lt 1 ]] && return 1
local version
IFS=$'\n'
read -d '' -r -a version <<< "$(echo "$1" | grep -oP '[0-9]+')"
local min_supported_version=(5 2 0)

# iterate over the version to support sliding tags e.g. v5
for (( i = 0; i < ${#version[@]}; i++ ))
do
if (( 10#${version[i]} > 10#${min_supported_version[i]} )); then
return 0
elif (( 10#${version[i]} < 10#${min_supported_version[i]} )); then
return 1
fi
done
return 0
}


while read -r version
do
export VERSION=$version
make_tag
if is_supported_version "$version"
then
export VERSION="$version"
make_tag
fi
done < <(fetch_tags)


Expand Down
2 changes: 1 addition & 1 deletion pre-commit-hooks.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
description: Static analysis tool for changed shell scripts
language: docker_image
entry: $DOCKERHOST/$DOCKERHUB:$VERSION
types: [shell]
pass_filenames: false

0 comments on commit 1c7171e

Please sign in to comment.