Skip to content

Commit

Permalink
refactor(sh): get_gh_release_latest - check for tag_name
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonos committed Dec 17, 2024
1 parent 51c3c44 commit 671a221
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .assets/provision/source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ get_gh_release_latest() {
fi
fi

# Check if the key 'tag_name' exists in the API response
tag_name="$(echo "$api_response" | jq -r 'try .tag_name catch empty')"
if [ 'null' != "$tag_name" ]; then
# Check if 'tag_name' exists
if echo "$api_response" | jq -e '.tag_name | select(. != null and . != "")' >/dev/null; then
tag_name="$(echo "$api_response" | jq -r '.tag_name')"
rel="$(echo $tag_name | sed -E 's/[^0-9]*([0-9]+\.[0-9]+\.[0-9]+)/\1/')"
if [ -n "$rel" ]; then
if [ -n "$asset" ]; then
Expand All @@ -148,7 +148,7 @@ get_gh_release_latest() {
fi
return 0
else
printf "\e[31mError: Returned tag_name doesn't conform to the semantic versioning.\e[0m\n" >&2
printf "\e[31mError: Returned tag_name doesn't conform to the semantic versioning ($tag_name).\e[0m\n" >&2
return 1
fi
else
Expand Down

0 comments on commit 671a221

Please sign in to comment.