parseCreateCheckRunConfig handles create-check-run configuration
(outputMap map[string]any)
| 20 | |
| 21 | // parseCreateCheckRunConfig handles create-check-run configuration |
| 22 | func (c *Compiler) parseCreateCheckRunConfig(outputMap map[string]any) *CreateCheckRunConfig { |
| 23 | if _, exists := outputMap["create-check-run"]; !exists { |
| 24 | return nil |
| 25 | } |
| 26 | |
| 27 | createCheckRunLog.Print("Parsing create-check-run configuration") |
| 28 | configData := outputMap["create-check-run"] |
| 29 | checkRunConfig := &CreateCheckRunConfig{} |
| 30 | |
| 31 | if configMap, ok := configData.(map[string]any); ok { |
| 32 | // Parse name |
| 33 | if name, exists := configMap["name"]; exists { |
| 34 | if nameStr, ok := name.(string); ok { |
| 35 | checkRunConfig.Name = nameStr |
| 36 | createCheckRunLog.Printf("Using custom check run name: %s", nameStr) |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | // Parse target (optional PR targeting mode) |
| 41 | if target, exists := configMap["target"]; exists { |
| 42 | if targetStr, ok := target.(string); ok { |
| 43 | checkRunConfig.Target = targetStr |
| 44 | createCheckRunLog.Printf("Using check run target: %s", targetStr) |
| 45 | } else { |
| 46 | createCheckRunLog.Printf("Warning: create-check-run target value %v is not a string and will be ignored", target) |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | // Parse optional output defaults block |
| 51 | if outputVal, exists := configMap["output"]; exists { |
| 52 | if outputConfigMap, ok := outputVal.(map[string]any); ok { |
| 53 | outputCfg := &CreateCheckRunOutputConfig{} |
| 54 | if title, ok := outputConfigMap["title"].(string); ok { |
| 55 | outputCfg.Title = title |
| 56 | createCheckRunLog.Printf("Using config output.title: %q", title) |
| 57 | } |
| 58 | if summary, ok := outputConfigMap["summary"].(string); ok { |
| 59 | outputCfg.Summary = summary |
| 60 | createCheckRunLog.Printf("Using config output.summary (len=%d)", len(summary)) |
| 61 | } |
| 62 | checkRunConfig.Output = outputCfg |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | // Parse common base fields with default max of 1 |
| 67 | c.parseBaseSafeOutputConfig(configMap, &checkRunConfig.BaseSafeOutputConfig, 1) |
| 68 | } else { |
| 69 | // If configData is nil or not a map (e.g., "create-check-run:" with no value), |
| 70 | // still set the default max of 1 |
| 71 | createCheckRunLog.Print("No config map provided, using defaults (max=1)") |
| 72 | checkRunConfig.Max = defaultIntStr(1) |
| 73 | } |
| 74 | |
| 75 | createCheckRunLog.Printf("Parsed create-check-run config: name=%q", checkRunConfig.Name) |
| 76 | return checkRunConfig |
| 77 | } |
no test coverage detected