Skip to content

Commit

Permalink
use keys_unsorted[]
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzsequence committed Jul 12, 2023
1 parent 3910eb8 commit 426145e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bin/test-dependencies-yml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ valid_versions=true
echo "Checking ${filename} for valid versions..."

# Parse the YAML file and validate the current_tag values
yq e '.dependencies | to_entries[] | "\(.key): \(.value.current_tag)"' "${filename}" | while IFS=':' read -r key value; do
key=$(echo "${key}" | awk '{$1=$1};1')
value=$(echo "${value}" | awk '{$1=$1};1')
yq eval '.dependencies | keys_unsorted[]' "${filename}" | while IFS='' read -r key; do
current_tag=$(yq eval ".dependencies[\"${key}\"].current_tag" "${filename}")
current_tag=$(echo "${current_tag}" | awk '{$1=$1};1')

if [[ $key != "" ]]; then
echo -n "Validating version for ${key}... "
if [[ ! $value =~ $version_pattern ]]; then
echo -e "${red}Invalid version: ${value}${reset}"
if [[ ! $current_tag =~ $version_pattern ]]; then
echo -e "${red}Invalid version: ${current_tag}${reset}"
valid_versions=false
else
echo -e "${green}OK${reset}"
Expand Down

0 comments on commit 426145e

Please sign in to comment.