Refactor custom steps to support strongly-typed placement positions#2088
Closed
Refactor custom steps to support strongly-typed placement positions#2088
Conversation
- Add Step struct representing GitHub Actions workflow steps - Add WorkflowSteps struct with pre, pre-agent, post-agent, post positions - Add ParseStepsFromFrontmatter to parse both legacy array and new object formats - Update compiler to use new ParsedSteps with proper rendering at each position - Add post-agent field support (preferred over post-steps) - Maintain backward compatibility with legacy steps and post-steps fields - Update frontmatter schema to support new format - Add comprehensive tests for new format and backward compatibility Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Update .github/instructions with new steps format documentation - Document the four step placement positions (pre, pre-agent, post-agent, post) - Document step execution order - Document legacy format backward compatibility - Mark post-steps as deprecated in favor of post-agent - Add examples for all step formats - Document step merging behavior with imports Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Remove unused stepsToYAML function - Fix unnecessary assignment to blank identifier - All linting checks pass Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor custom steps in agentic workflows
Refactor custom steps to support strongly-typed placement positions
Oct 21, 2025
- Remove post-agent field from schema (only nested format supported) - Remove post-steps field from schema (fully deprecated) - Update compiler to remove parsing of top-level post-agent/post-steps - Remove fallback to legacy CustomSteps/PostSteps in rendering - Convert test-post-steps.md workflow to use nested format - Update all tests to use nested steps.post-agent format - Update documentation to remove references to top-level fields - Add comprehensive documentation for nested steps format All 67 workflows compile successfully. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
Completed in b090a8c. Removed top-level |
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.
Overview
This PR refactors the custom steps implementation in GitHub Agentic Workflows to use strongly-typed Go structs and introduces a new object-based format that supports multiple step placement positions. The changes provide better control over when custom steps execute relative to agent execution.
Problem
Previously, custom steps were managed as YAML string fragments with only two placement options:
steps: Runs before agent executionpost-steps: Runs after agent executionThis limited granularity made it difficult to:
Solution
New Step Structures
Introduced strongly-typed Go structures for managing workflow steps:
Stepstruct: Represents a GitHub Actions workflow step with all standard fields:WorkflowStepsstruct: Organizes steps into four placement positions:Frontmatter Format
Users must now use an object-based format for step placement. Top-level
post-stepsandpost-agentfields have been removed:Legacy array format is still supported and maps to
pre-agentposition:Step Execution Order
The complete workflow execution order is now:
steps.pre)steps.pre-agentor legacystepsarray)steps.post-agent)steps.post)Breaking Changes
post-stepsfield: Must now usesteps: { post-agent: [...] }post-agentfield: Must now usesteps: { post-agent: [...] }Changes
Core Implementation
pkg/workflow/step.gowithStepandWorkflowStepstypesParseStepsFromFrontmatter()to parse both legacy array and new object formatsWorkflowDatastruct to includeParsedSteps *WorkflowStepsrenderStepsAtPosition()for proper YAML generationpost-stepsandpost-agentfieldsSchema Updates
pkg/parser/schemas/main_workflow_schema.jsonto support object format with named positionspost-agentfield definitionpost-stepsfield definitionpre-agentposition)Workflow Conversions
.github/workflows/test-post-steps.mdto use nestedsteps: { post-agent: [...] }formatDocumentation
.github/instructions/github-agentic-workflows.instructions.mdTesting
step_test.go)step_integration_test.go)Migration Guide
Workflows using top-level
post-stepsorpost-agentfields must be updated:Before (no longer supported):
After (required):
Or using legacy array format for pre-agent steps:
Benefits
Testing
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.