extractStringFromMap is a generic helper that extracts and validates a string value from a map Returns the string value, or empty string if not present or invalid If log is provided, it will log the extracted value for debugging
(m map[string]any, key string, debugLog *logger.Logger)
| 110 | // Returns the string value, or empty string if not present or invalid |
| 111 | // If log is provided, it will log the extracted value for debugging |
| 112 | func extractStringFromMap(m map[string]any, key string, debugLog *logger.Logger) string { |
| 113 | if value, exists := m[key]; exists { |
| 114 | if valueStr, ok := value.(string); ok { |
| 115 | if debugLog != nil { |
| 116 | debugLog.Printf("Parsed %s from config: %s", key, valueStr) |
| 117 | } |
| 118 | return valueStr |
| 119 | } |
| 120 | } |
| 121 | return "" |
| 122 | } |
| 123 | |
| 124 | // parseTargetRepoWithValidation extracts the target-repo value from a config map and validates it. |
| 125 | // Returns the target repository slug as a string, or empty string if not present or invalid. |