Loop: for each item
Goal
Run a block once per array item and use the collected results. Time: 15 minutes.
Loop facts
| Fact | Value |
|---|---|
| Loop context | loop.item (the current element), loop.index (starts at 1), loop.count |
| Output | steps.<loop id>.results: one object per pass, keyed by child block ID, plus status and exit |
max | Defaults to 20, and the ceiling is 100 |
| Passes per run | 100 in total, across all loops |
| Nesting | Up to 2 levels deep |
| Blocks per file | 40, including loop bodies |
In the editor, a loop is a frame. Add blocks with the + inside the frame, or drag existing blocks into it. While it runs, the frame shows progress such as 3 of 12. Keep the - id: of each child indented under body: in YAML.
Check your run
count_passes publishes count: 3 and first: "Hello Ada (1/3)". On Runs, greet appears three times, once per pass.
Exercise
Replace the inline names block with a workflow input: declare inputs: names: {type: array, items: {type: string}} and loop over inputs.names.
