Make timeout-minutes a templatable integer in schema + custom job compilation#36314
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
Validate templated timeout-minutes in schema and compiler
Make Jun 1, 2026
timeout-minutes a templatable integer in schema + custom job compilation
Copilot created this pull request from a session on behalf of
pelikhan
June 1, 2026 19:40
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aligns timeout-minutes handling across the JSON schema and the Go workflow compiler so that it accepts either a literal integer or a GitHub Actions expression (${{ ... }}), and renders expression-form timeouts correctly for custom jobs.
Changes:
- Update workflow-level and job-level schema for
timeout-minutesto use a shared “templatable integer” shape. - Extend custom job compilation to preserve expression-form
timeout-minutesand emit it during job YAML rendering. - Add targeted tests covering schema acceptance, rendering of expression timeouts, and rejection of invalid string values / conflicting configs.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/jobs.go | Add TimeoutMinutesExpression and render expression-form timeout-minutes when present. |
| pkg/workflow/jobs_validation.go | Extend validation to forbid timeout-minutes (int or expression) on reusable-workflow caller jobs and reject int+expression conflicts. |
| pkg/workflow/jobs_test.go | Add unit tests for reusable-workflow restriction with expression timeouts and conflict validation. |
| pkg/workflow/compiler_jobs.go | Parse custom job timeout-minutes strings as expressions (reject non-expression strings). |
| pkg/workflow/compiler_jobs_test.go | Add tests for expression parsing/rendering and invalid string rejection. |
| pkg/parser/schemas/main_workflow_schema.json | Switch workflow/job timeout-minutes to reference templatable_integer. |
| pkg/parser/schema_test.go | Add schema test ensuring templated workflow/job timeout-minutes values validate. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 7/7 changed files
- Comments generated: 3
Comment on lines
2483
to
2486
| "timeout-minutes": { | ||
| "type": "integer", | ||
| "minimum": 1, | ||
| "$ref": "#/$defs/templatable_integer", | ||
| "description": "Job timeout in minutes" | ||
| }, |
Comment on lines
2633
to
2637
| "timeout-minutes": { | ||
| "$ref": "#/$defs/templatable_integer", | ||
| "description": "Workflow timeout in minutes (GitHub Actions standard field). Defaults to 20 minutes for agentic workflows. Has sensible defaults and can typically be omitted. Custom runners support longer timeouts beyond the GitHub-hosted runner limit. Supports GitHub Actions expressions (e.g. '${{ inputs.timeout }}') for reusable workflow_call workflows.", | ||
| "oneOf": [ | ||
| { | ||
| "type": "integer", | ||
| "minimum": 1, | ||
| "examples": [5, 10, 30] | ||
| }, | ||
| { | ||
| "type": "string", | ||
| "pattern": "^\\$\\{\\{.*\\}\\}$", | ||
| "description": "GitHub Actions expression that resolves to an integer (e.g. '${{ inputs.timeout }}')" | ||
| } | ||
| ] | ||
| "examples": [5, 10, 30] | ||
| }, |
Comment on lines
+664
to
+666
| // isExpression validates full GitHub Actions expression syntax (${{ | ||
| // ... }}) and is defined in expression_patterns.go. | ||
| if isExpression(v) { |
This was referenced Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
timeout-minutesneeded to validate as atemplatable_integerand behave consistently when provided as either a literal integer or a GitHub Actions expression. This change aligns schema validation and Go-side job rendering with that contract.Schema updates
timeout-minutesdefinitions to the shared templatable-integer shape inmain_workflow_schema.json.${{ ... }}timeout expressions validate in the same path as integer literals.Go compiler behavior
timeout-minuteswhen present.Guardrails
timeout-minutesin custom jobs.Targeted coverage additions