Skip to content

[plan] Parameterize timeout-minutes frontmatter field to accept GitHub Actions expressions #23839

@github-actions

Description

@github-actions

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 validation

Expected Behavior

timeout-minutes: 30                     # ✅ Literal integer
timeout-minutes: ${{ inputs.timeout }}  # ✅ Expression string

Approach

  1. Update JSON schema in pkg/parser/schemas/main_workflow_schema.json:

    • Change timeout-minutes from type: integer to oneOf: [integer, expression-string] or use a pattern constraint to accept ${{ ... }} strings alongside integers.
  2. Update FrontmatterConfig in pkg/workflow/frontmatter_types.go:

    • Change TimeoutMinutes int to TimeoutMinutes *string (templatable pattern).
  3. Update frontmatter parsing in pkg/workflow/frontmatter_types.go (or wherever TimeoutMinutes is populated):

    • Call preprocessIntFieldAsString(data, "timeout-minutes", log) before unmarshaling.
  4. Update compilation in pkg/workflow/compiler_yaml.go (or wherever timeout-minutes is emitted to the compiled YAML):

    • Use templatableIntValue() for compile-time integer paths.
    • Use buildTemplatableIntEnvVar where the expression needs to be passed to runtime.
    • Ensure timeout-minutes in the compiled YAML receives the expression correctly (GitHub Actions evaluates ${{ inputs.timeout }} in the YAML at runtime).
  5. Rebuild binary: make build (schema embedded via //go:embed).

  6. Add/update tests: Cover literal integer, expression string, and invalid string cases.

Files to Modify

  • pkg/parser/schemas/main_workflow_schema.json — relax type constraint
  • pkg/workflow/frontmatter_types.go — change field type to *string
  • pkg/workflow/compiler_yaml.go (or compiler output code) — handle expression in emitted YAML
  • Test files in pkg/workflow/ or pkg/parser/

Acceptance Criteria

  • timeout-minutes: 30 still 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

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions