GitHub Actions step id containing a dash cannot be referenced in steps context
A step id is used as a property key in the steps context, e.g. steps.build.outputs.x. Ids with dashes still work via bracket access, but dot access (steps.my-step.outputs) parses my and -step separately and resolves to nothing.
What this error means
steps.<id>.outputs.<name> is empty when the step id contains a dash and is accessed with dot syntax.
- id: my-step
run: echo "v=1" >> "$GITHUB_OUTPUT"
- run: echo "${{ steps.my-step.outputs.v }}" # dot access mis-parses the dashCommon causes
Dash breaks dot property access
Dot access treats the dash as an operator, so steps.my-step does not resolve to the step.
Id mismatch between definition and reference
A reference that does not exactly match the id resolves to an empty object.
How to fix it
Use an id without dashes
- Prefer underscores in step ids so dot access works cleanly.
- Update all references to the new id.
- id: my_step
run: echo "v=1" >> "$GITHUB_OUTPUT"
- run: echo "${{ steps.my_step.outputs.v }}"Reference a dashed id with bracket syntax
- If you must keep the dash, use bracket access on the steps context.
- Quote the id inside the brackets.
- run: echo "${{ steps['my-step'].outputs.v }}"How to prevent it
- Use underscores, not dashes, in step ids.
- Keep id definitions and references identical.