feat(step.foreach): add item_var, single-step, and foreach.index support#181
Merged
feat(step.foreach): add item_var, single-step, and foreach.index support#181
Conversation
… support Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add step.foreach pipeline step for list iteration
feat(step.foreach): add item_var, single-step, and foreach.index support
Feb 27, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds missing spec features to the step.foreach pipeline step so foreach iterations can bind a custom item variable name, define a single sub-step via shorthand, and reference an iteration-scoped foreach map in templates.
Changes:
- Add
item_varas the canonical per-item binding key (keepingitem_keyfor backward compatibility). - Support
step(singular) as an alternative tostepsfor single sub-step configurations. - Inject
foreachcontext (includingforeach.index) into each iteration; update wfctl type registry and add tests.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| module/pipeline_step_foreach.go | Adds item_var, step shorthand parsing, and injects foreach map into child context. |
| module/pipeline_step_foreach_test.go | Adds tests for item_var, step shorthand, foreach.index, and error cases. |
| cmd/wfctl/type_registry.go | Updates step.foreach ConfigKeys to include new supported options. |
Contributor
|
@copilot apply changes based on the comments in this thread |
…dation, reuse buildSubStep Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
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.
step.foreachimplementationitem_varconfig key support (item_varis now canonical;item_keyretained for backward compat)step(singular) config key support as alternative tosteps{{.foreach.index}}access via aforeachmap injected into child contextcmd/wfctl/type_registry.goConfigKeys forstep.foreachappparameter from StepFactory to sub-step factories (was using captured outerapp=nil)appparam fromNewForEachStepFactory(matchesNewRetryWithBackoffStepFactorysignature)step/stepstypes explicitly; error when both are providedforeachBuildSubStepwith sharedbuildSubStephelperforeachmap injection to avoid overwriting conflicting user keysstep/steps, wrong types,appthreading, conflict guard✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.