Use for:
in steps to invoke tasks repeatedly with different loop variables.
Examples
name: List Loop Example
vars:
components:
- src/main
- src/utils
- src/api
tasks:
build:
aliases: [default]
desc: Build all components
steps:
- for: component in components
task: build_component
build_component:
requires: [component]
steps:
- run: 'echo "Building component: ${{ component }}"'
name: Nested Loop Example
vars:
environments:
- dev
- staging
- prod
service_version: 1.2.3
tasks:
deploy_all:
aliases: [default]
desc: Deploy to all environments
steps:
- for: env in environments
task: deploy_service
deploy_service:
desc: Deploy to a specific environment
requires: [env, service_version]
steps:
- run: echo "Deploying v${{ service_version }} to ${{ env }}..."
name: Matrix Loop Example
vars:
platforms:
- linux
- darwin
- windows
architectures:
- amd64
- arm64
tasks:
build_all:
aliases: [default]
desc: Cross-compile for all platforms
steps:
- for: platform in platforms
task: build_platform
build_platform:
requires: [platform]
steps:
- for: arch in architectures
task: compile
compile:
requires: [platform, arch]
steps:
- run: echo "Building for ${{ platform }}/${{ arch }}..."

How It Works
for:in a step - defines the loop withfor: variable in collectiontask:in the same step - names the task to invoke for each iteration- Loop variable
- becomes available in the invoked task as
${{ variable }} requires:- the invoked task can declare required variables to validate they are present
Missing Variables
If a required variable is missing, execution fails with a clear error:
job 'deploy_service' requires variables [env service_version] but missing: [env]