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

Function preprocessExpiresField

pkg/workflow/config_preprocessing.go:174–193  ·  view source on GitHub ↗

preprocessExpiresField handles the common expires field preprocessing pattern. This function: 1. Parses the expires value through parseExpiresFromConfig (handles integers, strings, and boolean false) 2. Handles explicit disablement when expires=false (returns -1) 3. Normalizes the value to hours and

(configData map[string]any, debugLog *logger.Logger)

Source from the content-addressed store, hash-verified

172// Returns true if expires was explicitly disabled with false, false otherwise.
173// This helper consolidates duplicate preprocessing logic used in parseCreateIssuesConfig and parseCreateDiscussionsConfig.
174func preprocessExpiresField(configData map[string]any, debugLog *logger.Logger) bool {
175 expiresDisabled := false
176 if configData != nil {
177 if expires, exists := configData["expires"]; exists {
178 expiresInt := parseExpiresFromConfig(configData)
179 if expiresInt == -1 {
180 expiresDisabled = true
181 configData["expires"] = 0
182 } else if expiresInt > 0 {
183 configData["expires"] = expiresInt
184 } else {
185 configData["expires"] = 0
186 }
187 if debugLog != nil {
188 debugLog.Printf("Parsed expires value %v to %d hours (disabled=%t)", expires, expiresInt, expiresDisabled)
189 }
190 }
191 }
192 return expiresDisabled
193}

Callers 2

parseCreateEntityConfigFunction · 0.85

Calls 2

parseExpiresFromConfigFunction · 0.85
PrintfMethod · 0.45

Tested by 1