-
Notifications
You must be signed in to change notification settings - Fork 328
[plan] Parameterize timeout-minutes frontmatter field to accept GitHub Actions expressions #23839
Description
Objective
Allow the timeout-minutes frontmatter field to accept GitHub Actions expression strings (e.g. ${{ inputs.timeout }}) in addition to literal integer values, enabling reusable workflow_call workflows to customize timeout at call time.
Context
Tracked in issue #23724. The existing infrastructure in pkg/workflow/templatables.go already has preprocessIntFieldAsString and buildTemplatableIntEnvVar helpers for exactly this pattern. timeout-minutes is the lowest-risk field to start with.
Current Behavior
timeout-minutes: 30 # Only literal integers work
timeout-minutes: ${{ inputs.timeout }} # ❌ Fails schema validationExpected Behavior
timeout-minutes: 30 # ✅ Literal integer
timeout-minutes: ${{ inputs.timeout }} # ✅ Expression stringApproach
-
Update JSON schema in
pkg/parser/schemas/main_workflow_schema.json:- Change
timeout-minutesfromtype: integertooneOf: [integer, expression-string]or use a pattern constraint to accept${{ ... }}strings alongside integers.
- Change
-
Update
FrontmatterConfiginpkg/workflow/frontmatter_types.go:- Change
TimeoutMinutes inttoTimeoutMinutes *string(templatable pattern).
- Change
-
Update frontmatter parsing in
pkg/workflow/frontmatter_types.go(or whereverTimeoutMinutesis populated):- Call
preprocessIntFieldAsString(data, "timeout-minutes", log)before unmarshaling.
- Call
-
Update compilation in
pkg/workflow/compiler_yaml.go(or wherevertimeout-minutesis emitted to the compiled YAML):- Use
templatableIntValue()for compile-time integer paths. - Use
buildTemplatableIntEnvVarwhere the expression needs to be passed to runtime. - Ensure
timeout-minutesin the compiled YAML receives the expression correctly (GitHub Actions evaluates${{ inputs.timeout }}in the YAML at runtime).
- Use
-
Rebuild binary:
make build(schema embedded via//go:embed). -
Add/update tests: Cover literal integer, expression string, and invalid string cases.
Files to Modify
pkg/parser/schemas/main_workflow_schema.json— relax type constraintpkg/workflow/frontmatter_types.go— change field type to*stringpkg/workflow/compiler_yaml.go(or compiler output code) — handle expression in emitted YAML- Test files in
pkg/workflow/orpkg/parser/
Acceptance Criteria
-
timeout-minutes: 30still works (backward compatible) -
timeout-minutes: ${{ inputs.timeout }}compiles and the expression appears correctly in the compiled.lock.yml - Invalid strings (non-expressions) produce a clear error message
- Schema validation accepts the new type union
- Tests pass:
make agent-finish
Related to Ask: Runtime Parameterization of Compile-Time Frontmatter Fields #23724
Generated by Plan Command for issue #23724 · ◷
- expires on Apr 3, 2026, 5:44 AM UTC