GitHub Actions composite action output empty in the caller in CI
A composite action only exposes an output if it is declared under outputs: and mapped to a step output via steps.<id>.outputs.<name>. The step must write to $GITHUB_OUTPUT and have an id.
What this error means
A caller step reads steps.<id>.outputs.<name> from the composite action and gets an empty string. The value was produced inside the action but never exported.
# caller
echo "version="
# steps.setup.outputs.version was empty: action.yml did not map the output
# to a step output, or the step did not write to $GITHUB_OUTPUTCommon causes
The output was not declared and mapped
A composite output must be declared under outputs: and set its value to steps.<id>.outputs.<name>. Without the mapping, the caller sees nothing.
The inner step did not write GITHUB_OUTPUT
The step that produces the value must have an id and append name=value to $GITHUB_OUTPUT for the mapping to resolve.
How to fix it
Declare and map the composite output
- Give the producing step an id and write to $GITHUB_OUTPUT.
- Declare the output under outputs: mapping to steps.<id>.outputs.<name>.
- Read it in the caller as steps.<action-step-id>.outputs.<name>.
outputs:
version:
value: ${{ steps.detect.outputs.version }}
runs:
using: composite
steps:
- id: detect
run: echo "version=1.2.3" >> "$GITHUB_OUTPUT"
shell: bashConsume the output in the caller
Give the action step an id and read its output downstream.
- id: setup
uses: ./.github/actions/setup
- run: echo "${{ steps.setup.outputs.version }}"
shell: bashHow to prevent it
- Declare every composite output and map it to a step output.
- Give producing steps an id and write to $GITHUB_OUTPUT.
- Give the action step an id in the caller to read its outputs.