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

Function preprocessHideOlderCommentsConfig

pkg/workflow/add_comment.go:84–120  ·  view source on GitHub ↗
(configData map[string]any, debugLog *logger.Logger)

Source from the content-addressed store, hash-verified

82}
83
84func preprocessHideOlderCommentsConfig(configData map[string]any, debugLog *logger.Logger) error {
85 if configData == nil {
86 return nil
87 }
88
89 raw, exists := configData["hide-older-comments"]
90 if !exists || raw == nil {
91 return nil
92 }
93
94 objectConfig, ok := raw.(map[string]any)
95 if !ok {
96 return nil
97 }
98
99 if enabledRaw, hasEnabled := objectConfig["enabled"]; hasEnabled {
100 switch enabled := enabledRaw.(type) {
101 case bool:
102 configData["hide-older-comments"] = enabled
103 case string:
104 if !isExpression(enabled) {
105 return fmt.Errorf("field %q must be a boolean or a GitHub Actions expression", "hide-older-comments.enabled")
106 }
107 configData["hide-older-comments"] = enabled
108 default:
109 return fmt.Errorf("field %q must be a boolean or a GitHub Actions expression", "hide-older-comments.enabled")
110 }
111 } else {
112 configData["hide-older-comments"] = true
113 }
114
115 if matchRaw, hasMatch := objectConfig["match"]; hasMatch {
116 configData["hide-older-comments-match"] = parseStringSliceAny(matchRaw, debugLog)
117 }
118
119 return nil
120}
121
122// buildAddCommentPermissions computes the permissions for the add_comment job based on config.
123// Issues: nil or true → issues:write (default: true)

Callers 1

parseCommentsConfigMethod · 0.85

Calls 3

isExpressionFunction · 0.85
parseStringSliceAnyFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected