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

Function parseTargetRepoWithValidation

pkg/workflow/config_helpers.go:128–136  ·  view source on GitHub ↗

parseTargetRepoWithValidation extracts the target-repo value from a config map and validates it. Returns the target repository slug as a string, or empty string if not present or invalid. Returns an error (indicated by the second return value being true) if the value is "*" (wildcard), which is not

(configMap map[string]any)

Source from the content-addressed store, hash-verified

126// Returns an error (indicated by the second return value being true) if the value is "*" (wildcard),
127// which is not allowed for safe output target repositories.
128func parseTargetRepoWithValidation(configMap map[string]any) (string, bool) {
129 targetRepoSlug := extractStringFromMap(configMap, "target-repo", configHelpersLog)
130 // Validate that target-repo is not "*" - only definite strings are allowed
131 if targetRepoSlug == "*" {
132 configHelpersLog.Print("Invalid target-repo: wildcard '*' is not allowed")
133 return "", true // Return true to indicate validation error
134 }
135 return targetRepoSlug, false
136}
137
138// NOTE: parseExpiresFromConfig and parseRelativeTimeSpec have been moved to time_delta.go
139// to consolidate all time parsing logic in a single location. These functions are used

Calls 2

extractStringFromMapFunction · 0.85
PrintMethod · 0.80

Tested by 1