You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
102
-
if [[ -z "$url" ]]; then # Skip empty values inside arrays
98
+
local field_type=$(echo "$metadata" | yq -r ".${field} | type")
99
+
local non_empty_value=0
100
+
101
+
if [[ "$field_type" == "!!seq" ]]; then
102
+
for url in $(echo "$metadata" | yq ".$field | .[]"); do
103
+
if [[ -z "$url" ]]; then
103
104
continue
104
105
fi
105
106
if [[ ! "$url" =~ ^https?:\/\/[a-zA-Z0-9.-]+(\.[a-zA-Z]{2,})+(:[0-9]{1,5})?(\/.*)?$ ]]; then
106
107
echo "::error file=$metadata_file::'$field' contains an invalid URL: $url"
107
108
((errors++))
109
+
else
110
+
((non_empty_value++))
108
111
fi
109
112
done
113
+
if [[ $non_empty_value -eq 0 && "$required" == "required" ]]; then
114
+
echo "::error file=$metadata_file::'$field' is required but missing"
115
+
((errors++))
116
+
fi
110
117
else
111
118
if [[ ! "$value" =~ ^https?:\/\/[a-zA-Z0-9.-]+(\.[a-zA-Z]{2,})+(:[0-9]{1,5})?(\/.*)?$ ]]; then
112
119
echo "::error file=$metadata_file::'$field' is not a valid URL"
@@ -122,18 +129,19 @@ jobs:
122
129
check_required_field "detailed_description"
123
130
124
131
# Validate URLs (optional fields but must be valid if provided, add "required" as second parameter to make them required, ie: check_valid_url "community_url" "required")
echo "::error file=$metadata_file::'$support_contact' is required but missing"
170
+
echo "::error file=$metadata_file::'support_contact' is required but missing"
161
171
((errors++))
162
172
else
163
173
if [[ ! "$support_contact" =~ ^(https?:\/\/[a-zA-Z0-9.-]+(\.[a-zA-Z]{2,})+(:[0-9]{1,5})?(\/.*)?|[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})$ ]]; then
0 commit comments