Skip to content

Detect and validate shared workflows missing 'on' field#8468

Merged
pelikhan merged 3 commits into
mainfrom
copilot/validate-shared-agentic-workflow
Jan 1, 2026
Merged

Detect and validate shared workflows missing 'on' field#8468
pelikhan merged 3 commits into
mainfrom
copilot/validate-shared-agentic-workflow

Conversation

Copilot AI commented Jan 1, 2026

Copy link
Copy Markdown
Contributor

Workflows without an on trigger field now validate against included_file_schema instead of failing main_workflow_schema validation. Compilation is skipped with an informative message.

Detection

  • Check for missing on field before schema validation
  • Validate with included_file_schema (allows optional markdown content)
  • Return SharedWorkflowError to signal skip

CLI handling

  • Recognize SharedWorkflowError as info, not error
  • Print usage instructions, mark as successful (skipped)
  • No lock file generated

Example output

$ gh aw compile shared/mcp/deepwiki.md
ℹ️  Shared agentic workflow detected: deepwiki.md

This workflow is missing the 'on' field and will be treated as a shared workflow component.
Shared workflows are reusable components meant to be imported by other workflows.

To use this shared workflow:
  1. Import it in another workflow's frontmatter:
     ---
     on: issues
     imports:
       - shared/mcp/deepwiki.md
     ---

  2. Compile the workflow that imports it

Skipping compilation.
✓ Compiled 1 workflow(s): 0 error(s), 0 warning(s)

Files

  • pkg/workflow/compiler_orchestrator.go - detection logic
  • pkg/workflow/shared_workflow_error.go - error type (new)
  • pkg/workflow/shared_workflow_test.go - tests (new)
  • pkg/cli/compile_workflow_processor.go - CLI handling
Original prompt

When an agentic workflow is missing the "on" field, implicitly assume it is a shared agentic workflow and validate with the imported JSON schema (not the main schema). Skip compilation with info message.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 1, 2026 17:35
- Detect workflows missing 'on' field and treat as shared workflows
- Validate shared workflows with included_file_schema instead of main_workflow_schema
- Skip compilation with informative message for shared workflows
- Allow shared workflows without markdown content (config-only workflows)
- Add comprehensive tests for shared workflow handling

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Validate shared agentic workflow when missing 'on' field Detect and validate shared workflows missing 'on' field Jan 1, 2026
Copilot AI requested a review from pelikhan January 1, 2026 17:40
@pelikhan pelikhan marked this pull request as ready for review January 1, 2026 17:53
@pelikhan pelikhan merged commit afecb3f into main Jan 1, 2026
170 checks passed
@pelikhan pelikhan deleted the copilot/validate-shared-agentic-workflow branch January 1, 2026 17:55
github-actions Bot added a commit that referenced this pull request Jan 1, 2026
Updates documentation to reflect the shared workflow detection feature
added in PR #8468. Workflows without an 'on' field are now automatically
detected as shared workflow components and skip compilation with an
informative message.

Changes:
- Added shared workflow detection notes to CLI compile command docs
- Added new "Shared Workflow Components" section to imports reference
- Included example output showing the compiler's informative message

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants