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

Function parseTimeoutTool

pkg/workflow/tools_parser.go:541–566  ·  view source on GitHub ↗

parseTimeoutTool converts raw timeout tool configuration to a TemplatableInt32 value. Accepts integers and GitHub Actions expressions (e.g. "${{ inputs.tool-timeout }}").

(val any)

Source from the content-addressed store, hash-verified

539// parseTimeoutTool converts raw timeout tool configuration to a TemplatableInt32 value.
540// Accepts integers and GitHub Actions expressions (e.g. "${{ inputs.tool-timeout }}").
541func parseTimeoutTool(val any) *TemplatableInt32 {
542 switch v := val.(type) {
543 case int:
544 t := TemplatableInt32(strconv.Itoa(v))
545 return &t
546 case int64:
547 t := TemplatableInt32(strconv.FormatInt(v, 10))
548 return &t
549 case uint:
550 t := TemplatableInt32(strconv.FormatUint(uint64(v), 10))
551 return &t
552 case uint64:
553 t := TemplatableInt32(strconv.FormatUint(v, 10))
554 return &t
555 case float64:
556 t := TemplatableInt32(strconv.Itoa(int(v)))
557 return &t
558 case string:
559 if isExpression(v) {
560 t := TemplatableInt32(v)
561 return &t
562 }
563 return nil // reject non-expression strings
564 }
565 return nil
566}
567
568// parseStartupTimeoutTool converts raw startup-timeout tool configuration to a TemplatableInt32 value.
569// Accepts integers and GitHub Actions expressions (e.g. "${{ inputs.startup-timeout }}").

Callers 1

NewToolsFunction · 0.85

Calls 2

TemplatableInt32TypeAlias · 0.85
isExpressionFunction · 0.85

Tested by

no test coverage detected