ParseStringArrayFromConfig is a generic helper that extracts and validates a string array from a map Returns a slice of strings, or nil if not present or invalid If log is provided, it will log the extracted values for debugging
(m map[string]any, key string, debugLog *logger.Logger)
| 48 | // Returns a slice of strings, or nil if not present or invalid |
| 49 | // If log is provided, it will log the extracted values for debugging |
| 50 | func ParseStringArrayFromConfig(m map[string]any, key string, debugLog *logger.Logger) []string { |
| 51 | if value, exists := m[key]; exists { |
| 52 | if debugLog != nil { |
| 53 | debugLog.Printf("Parsing %s from config", key) |
| 54 | } |
| 55 | if strings := parseStringSliceAny(value, debugLog); strings != nil { |
| 56 | // Return the slice even if empty (to distinguish from not provided) |
| 57 | if len(strings) == 0 && debugLog != nil { |
| 58 | debugLog.Printf("No valid %s strings found, returning empty array", key) |
| 59 | } |
| 60 | if debugLog != nil { |
| 61 | debugLog.Printf("Parsed %d %s from config", len(strings), key) |
| 62 | } |
| 63 | return strings |
| 64 | } |
| 65 | } |
| 66 | return nil |
| 67 | } |
| 68 | |
| 69 | // ParseStringArrayOrExprFromConfig is like ParseStringArrayFromConfig but also accepts a |
| 70 | // GitHub Actions expression string as a valid value. When the raw value is an expression |