Skip to content

Commit 6055498

Browse files
committed
test
1 parent 148f9b6 commit 6055498

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

.github/workflows/validate-new-plugin-metadata.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,13 @@ jobs:
9494
9595
# Handle arrays of URLs (e.g., screenshots)
9696
# Check if the field is an array using yq length check
97-
is_array=$(echo "$metadata" | yq -r ".${field} | length")
98-
99-
if [[ "$is_array" =~ ^[0-9]+$ && "$is_array" -gt 0 ]]; then
100-
# Iterate properly over array elements
101-
for url in $(echo "$metadata" | yq -r ".$field[]" || true); do
97+
local field_type
98+
field_type=$(echo "$metadata" | yq -r ".${field} | type")
99+
100+
if [[ "$field_type" == "!!seq" ]]; then
101+
# Properly iterate over the array elements
102+
echo "$metadata" | yq -r ".$field[]?" | while IFS= read -r url; do
103+
echo "Validating URL: $url"
102104
if [[ -z "$url" ]]; then # Skip empty values inside arrays
103105
continue
104106
fi
@@ -107,11 +109,6 @@ jobs:
107109
((errors++))
108110
fi
109111
done
110-
else
111-
if [[ ! "$value" =~ ^https?:\/\/[a-zA-Z0-9.-]+(\.[a-zA-Z]{2,})+(:[0-9]{1,5})?(\/.*)?$ ]]; then
112-
echo "::error file=$metadata_file::'$field' is not a valid URL"
113-
((errors++))
114-
fi
115112
fi
116113
}
117114

0 commit comments

Comments
 (0)