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

Function parseMaxTurnsValue

pkg/workflow/engine_config_parser.go:58–79  ·  view source on GitHub ↗
(raw any)

Source from the content-addressed store, hash-verified

56}
57
58func parseMaxTurnsValue(raw any) string {
59 if val, ok := typeutil.ParseIntValue(raw); ok && val > 0 {
60 return strconv.Itoa(val)
61 }
62 if rawStr, ok := raw.(string); ok {
63 trimmed := strings.TrimSpace(rawStr)
64 if trimmed == "" {
65 return ""
66 }
67 if parsed, err := strconv.Atoi(trimmed); err == nil && parsed > 0 {
68 return strconv.Itoa(parsed)
69 }
70 // Match the same GitHub Actions expression wrapper accepted by the schema.
71 // The schema and GitHub Actions runtime are responsible for validating the
72 // expression body itself; this helper only needs to preserve templated values.
73 if strings.HasPrefix(trimmed, "${{") && strings.HasSuffix(trimmed, "}}") {
74 return trimmed
75 }
76 engineLog.Printf("Ignoring invalid max-turns value: %q", rawStr)
77 }
78 return ""
79}
80
81func parseMaxToolDenialsValue(raw any) string {
82 if val, ok := typeutil.ParseIntValue(raw); ok && val > 0 {

Callers 2

ExtractEngineConfigMethod · 0.85

Calls 2

ParseIntValueFunction · 0.92
PrintfMethod · 0.45

Tested by

no test coverage detected