File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -94,11 +94,12 @@ 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
97+ local field_type
98+ field_type=$(echo "$metadata" | yq -r ".${field} | type")
99+
100+ if [[ "$field_type" == "!!seq" ]]; then
100101 # Iterate properly over array elements
101- for url in $(echo "$metadata" | yq -r ".$field[]" || true ); do
102+ for url in $(echo "$metadata" | yq ".${ field} | .[]" ); do
102103 if [[ -z "$url" ]]; then # Skip empty values inside arrays
103104 continue
104105 fi
@@ -107,6 +108,15 @@ jobs:
107108 ((errors++))
108109 fi
109110 done
111+ for screenshot in $screenshots; do
112+ if [[ -z "$screenshot" ]]; then
113+ echo "::error file=$metadata_file::'screenshots' contains an empty string"
114+ ((errors++))
115+ elif [[ ! "$screenshot" =~ ^https?:\/\/[a-zA-Z0-9.-]+(\.[a-zA-Z]{2,})+(:[0-9]{1,5})?(\/.*)?\.(png|jpg|jpeg|gif|webp)$ ]]; then
116+ echo "::error file=$metadata_file::'screenshots' contains an invalid URL: $screenshot"
117+ ((errors++))
118+ fi
119+ done
110120 else
111121 if [[ ! "$value" =~ ^https?:\/\/[a-zA-Z0-9.-]+(\.[a-zA-Z]{2,})+(:[0-9]{1,5})?(\/.*)?$ ]]; then
112122 echo "::error file=$metadata_file::'$field' is not a valid URL"
You can’t perform that action at this time.
0 commit comments