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

Method parseUpdateDiscussionsConfig

pkg/workflow/update_discussion.go:23–45  ·  view source on GitHub ↗

parseUpdateDiscussionsConfig handles update-discussion configuration

(outputMap map[string]any)

Source from the content-addressed store, hash-verified

21
22// parseUpdateDiscussionsConfig handles update-discussion configuration
23func (c *Compiler) parseUpdateDiscussionsConfig(outputMap map[string]any) *UpdateDiscussionsConfig {
24 return parseUpdateEntityConfigTyped(c, outputMap,
25 UpdateEntityDiscussion, "update-discussion", updateDiscussionLog,
26 func(cfg *UpdateDiscussionsConfig) []UpdateEntityFieldSpec {
27 return []UpdateEntityFieldSpec{
28 {Name: "title", Mode: FieldParsingKeyExistence, Dest: &cfg.Title},
29 {Name: "body", Mode: FieldParsingKeyExistence, Dest: &cfg.Body},
30 {Name: "labels", Mode: FieldParsingKeyExistence, Dest: &cfg.Labels},
31 {Name: "footer", Mode: FieldParsingTemplatableBool, StringDest: &cfg.Footer},
32 }
33 },
34 func(cm map[string]any, cfg *UpdateDiscussionsConfig) {
35 // Parse allowed-labels using shared helper
36 cfg.AllowedLabels = ParseStringArrayFromConfig(cm, "allowed-labels", updateDiscussionLog)
37 if len(cfg.AllowedLabels) > 0 {
38 updateDiscussionLog.Printf("Allowed labels configured: %v", cfg.AllowedLabels)
39 // If allowed-labels is specified, implicitly enable labels
40 if cfg.Labels == nil {
41 cfg.Labels = new(bool)
42 }
43 }
44 })
45}

Callers 1

Calls 3

PrintfMethod · 0.45

Tested by

no test coverage detected