MCPcopy Create free account
hub / github.com/github/gh-aw / parseCreateCheckRunConfig

Method parseCreateCheckRunConfig

pkg/workflow/create_check_run.go:22–77  ·  view source on GitHub ↗

parseCreateCheckRunConfig handles create-check-run configuration

(outputMap map[string]any)

Source from the content-addressed store, hash-verified

20
21// parseCreateCheckRunConfig handles create-check-run configuration
22func (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}

Callers 1

Calls 4

defaultIntStrFunction · 0.85
PrintMethod · 0.80
PrintfMethod · 0.45

Tested by

no test coverage detected