Validation Timing
GitHub Agentic Workflows validates workflows at three distinct stages: during authoring, at compilation time, and during runtime execution. Understanding when each type of validation occurs helps identify and fix errors more efficiently.
Validation Stages Overview
Section titled “Validation Stages Overview”| Stage | When | What is Validated | Tool/Process |
|---|---|---|---|
| Schema Validation | Compilation | Frontmatter structure and types | gh aw compile |
| Compilation Validation | Compilation | File resolution, imports, and workflow generation | gh aw compile |
| Runtime Validation | Execution | GitHub Actions syntax, permissions, and engine operations | GitHub Actions |
Schema Validation (Compile Time)
Section titled “Schema Validation (Compile Time)”Schema validation occurs when running gh aw compile and validates the workflow frontmatter against the defined JSON schema.
What is Checked
Section titled “What is Checked”Frontmatter Structure:
- YAML syntax is valid
- All delimiters (
---) are present - Fields match the expected schema
Field Types:
- Strings are strings (
engine: "copilot") - Numbers are numbers (
timeout_minutes: 10) - Booleans are booleans (
strict: true) - Arrays are arrays (
imports: [...]) - Objects are objects (
tools: {...})
Required Fields:
on:trigger configuration is present- Engine-specific required fields exist
Enum Values:
- Fields with fixed value sets use valid values
- Examples:
engine: copilot,state: open
Field Constraints:
- Numeric ranges (e.g.,
timeout_minutes: 1-360) - String patterns (e.g., time delta format)
When Schema Validation Runs
Section titled “When Schema Validation Runs”# Explicit compilationgh aw compile
# Compile specific workflowgh aw compile my-workflow
# Compile with verbose outputgh aw compile --verboseTiming: Immediately when the command executes, before any file I/O or transformation.
Example Schema Errors
Section titled “Example Schema Errors”Invalid YAML Syntax:
---on:issues: # Missing indentation types: [opened]---Error: failed to parse frontmatter: yaml: line X: mapping values are not allowed in this context
Wrong Field Type:
---on: pushtimeout_minutes: "10" # String instead of number---Error: timeout_minutes must be an integer
Invalid Enum Value:
---on: pushengine: gpt4 # Not a valid engine ID---Error: engine must be one of: copilot, claude, codex, custom
Compilation Validation (Compile Time)
Section titled “Compilation Validation (Compile Time)”Compilation validation occurs during the transformation of the .md file into a .lock.yml GitHub Actions workflow file.
What is Checked
Section titled “What is Checked”File Resolution:
- Source workflow file exists
- Import files can be found and read
- Custom agent files are accessible
Import Processing:
- Import paths are valid
- Imported files have valid frontmatter
- No circular import dependencies
Workflow Generation:
- Engine configuration is complete
- Tool configurations are valid
- Safe outputs can be processed
- MCP server configurations are correct
Expression Validation:
- Context expressions use allowed variables only
- Expression syntax is valid
Cross-File References:
- Shared components resolve correctly
- Remote workflow specifications are valid
When Compilation Validation Runs
Section titled “When Compilation Validation Runs”Compilation validation runs after schema validation passes:
gh aw compileTiming: After schema validation, during the workflow transformation process.
Example Compilation Errors
Section titled “Example Compilation Errors”Import Not Found:
---on: pushimports: - shared/missing-file.md # File doesn't exist---Error: failed to resolve import 'shared/missing-file.md': file not found
Multiple Agent Files:
---on: pushimports: - .github/agents/agent1.md - .github/agents/agent2.md---Error: multiple agent files found in imports: 'agent1.md' and 'agent2.md'. Only one agent file is allowed per workflow
Unauthorized Expression:
---on: push---
Access secret: ${{ secrets.MY_SECRET }}Error: Compilation fails due to unauthorized expression ${{ secrets.MY_SECRET }}
Runtime Validation (Execution Time)
Section titled “Runtime Validation (Execution Time)”Runtime validation occurs when the compiled workflow executes in GitHub Actions.
What is Checked
Section titled “What is Checked”GitHub Actions Syntax:
- The generated
.lock.ymlis valid GitHub Actions YAML - Job dependencies are correct
- Step configurations are valid
Permissions:
- Token has required permissions for operations
- Repository settings allow the operations
Environment:
- Required tools are available (jq, git, etc.)
- Environment variables are set
- Secrets are accessible
Engine Operations:
- AI engine is accessible and authenticated
- MCP servers can connect
- Network access is available (if needed)
Dynamic Conditions:
- Trigger conditions match event
- Expressions evaluate correctly
- File paths resolve
Safe Outputs:
- Output format is correct
- Target repositories are accessible
- Branch protections allow operations
When Runtime Validation Occurs
Section titled “When Runtime Validation Occurs”Runtime validation happens in GitHub Actions during workflow execution:
- Workflow Trigger: Event matches
on:configuration - Job Start: Environment setup and authentication
- Step Execution: Each step validates its preconditions
- Tool Invocation: MCP servers and tools validate inputs
- Safe Output Processing: Post-processing jobs validate outputs
Timing: Continuous throughout the workflow run, as each component executes.
Example Runtime Errors
Section titled “Example Runtime Errors”Missing Tool:
jq not found in PATHCause: The jq command is required but not installed in the runner environment.
Permission Denied:
Error: Resource not accessible by integrationCause: GITHUB_TOKEN lacks the required permission (e.g., issues: write).
Authentication Required:
Error: authentication requiredCause: GitHub CLI authentication failed or token is invalid.
Time Delta Validation:
Error: invalid time delta format: +90m. Expected format like +25h, +3dCause: stop-after: +90m uses minutes, but minimum unit is hours.
Network Connection Failure:
Error: failed to connect to MCP server at https://example.comCause: MCP server is unreachable or network access is blocked.
Validation Flow Diagram
Section titled “Validation Flow Diagram”┌─────────────────┐│ Write Workflow ││ (.md file) │└────────┬────────┘ │ ▼┌─────────────────┐│ gh aw compile │ ◄─── Command executed└────────┬────────┘ │ ▼┌─────────────────────┐│ Schema Validation │ ◄─── Frontmatter structure & types├─────────────────────┤│ • YAML syntax ││ • Field types ││ • Required fields ││ • Enum values │└────────┬────────────┘ │ ▼ [PASS/FAIL] │ ▼ (if pass)┌──────────────────────┐│ Compilation │ ◄─── File resolution & transformation│ Validation │├──────────────────────┤│ • Import resolution ││ • Agent files ││ • Tool configs ││ • Expression checks │└────────┬─────────────┘ │ ▼ [PASS/FAIL] │ ▼ (if pass)┌──────────────────────┐│ Generate .lock.yml │ ◄─── Output file created└────────┬─────────────┘ │ ▼┌──────────────────────┐│ Commit & Push │└────────┬─────────────┘ │ ▼┌──────────────────────┐│ GitHub Actions │ ◄─── Workflow triggered│ Workflow Triggered │└────────┬─────────────┘ │ ▼┌──────────────────────┐│ Runtime Validation │ ◄─── Execution-time checks├──────────────────────┤│ • GH Actions syntax ││ • Permissions ││ • Environment setup ││ • Tool availability ││ • Engine operations ││ • Safe outputs │└────────┬─────────────┘ │ ▼ [SUCCESS/FAILURE]Best Practices for Each Stage
Section titled “Best Practices for Each Stage”Schema Validation Best Practices
Section titled “Schema Validation Best Practices”- Validate early: Run
gh aw compileafter each significant change - Use verbose mode: Add
--verboseflag to see detailed validation messages - Check types: Ensure numbers are not quoted, booleans are true/false
- Verify enums: Consult the frontmatter reference for valid values
- Format YAML: Use consistent indentation (2 spaces) and proper YAML syntax
Compilation Validation Best Practices
Section titled “Compilation Validation Best Practices”- Organize imports: Keep import files in a consistent location
- Test imports: Verify imported files compile independently
- Limit agent files: Use only one agent file per workflow
- Check expressions: Use only allowed context expressions
- Review lock files: Inspect generated
.lock.ymlto verify correctness
Runtime Validation Best Practices
Section titled “Runtime Validation Best Practices”- Test locally: Use
gh aw compileto catch issues before pushing - Check permissions: Verify
permissions:section matches operations - Verify secrets: Ensure required secrets are set in repository settings
- Monitor logs: Review GitHub Actions logs for runtime errors
- Use safe outputs: Prefer safe outputs over direct write permissions
- Set timeouts: Configure appropriate
timeout_minutesfor task complexity
Debugging by Stage
Section titled “Debugging by Stage”Schema Errors
Section titled “Schema Errors”Symptoms: Compilation fails immediately with YAML or type errors.
Debug Steps:
- Run
gh aw compile --verbose - Check the error line number in frontmatter
- Validate YAML syntax with online validator
- Consult the frontmatter schema reference
Compilation Errors
Section titled “Compilation Errors”Symptoms: Schema validation passes but compilation fails.
Debug Steps:
- Check import file paths and verify files exist
- Review error message for specific file or configuration issue
- Test imported files independently
- Validate expression usage against allowed list
Runtime Errors
Section titled “Runtime Errors”Symptoms: Workflow compiles but fails during execution.
Debug Steps:
- Review GitHub Actions workflow logs
- Check permissions and token access
- Verify environment has required tools
- Test MCP server connectivity
- Download logs with
gh aw logsfor detailed analysis
Error Recovery Workflow
Section titled “Error Recovery Workflow”When an error occurs:
- Identify the stage: Determine if error is schema, compilation, or runtime
- Read the message: Error messages indicate the specific problem
- Consult references: Use this guide and error reference
- Fix and revalidate: Make corrections and run
gh aw compileagain - Test incrementally: Compile after each fix to isolate remaining issues
Related Resources
Section titled “Related Resources”- Error Reference - Detailed error messages and solutions
- Common Issues - Frequently encountered problems
- Frontmatter Reference - Complete frontmatter options
- Workflow Structure - Workflow file format
- Templating - Allowed context expressions