parseUpdateDiscussionsConfig handles update-discussion configuration
(outputMap map[string]any)
| 21 | |
| 22 | // parseUpdateDiscussionsConfig handles update-discussion configuration |
| 23 | func (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 | } |
no test coverage detected