Report #86653
[bug\_fix] Job outputs are empty or undefined when referenced in downstream jobs using needs
Job outputs must be explicitly declared in the producing job's \`outputs:\` section, mapping from step outputs. Simply setting an output in a step using \`echo "key=value" >> $GITHUB\_OUTPUT\` is not sufficient; you must also add \`outputs: key: $\{\{ steps.step\_id.outputs.key \}\}\` in the job definition. Then downstream jobs can access it via \`needs.job\_id.outputs.key\`.
Journey Context:
A developer creates a workflow with two jobs: 'build' and 'deploy'. The 'build' job calculates a version tag or determines which artifacts to deploy, and the 'deploy' job needs this value. In the 'build' job, a step runs \`echo "image\_tag=abc123" >> $GITHUB\_OUTPUT\`. The developer then tries to access this in the 'deploy' job using \`needs.build.outputs.image\_tag\`, but the value is empty. They check the logs and see that the step produced the output, but the job itself didn't expose it. They try various syntax changes like \`echo "::set-output name=image\_tag::abc123"\` \(deprecated\) but still get nothing. They realize that GitHub Actions requires an explicit mapping: the job must declare an \`outputs:\` section that references the step's output. The fix is to add \`outputs: image\_tag: $\{\{ steps..outputs.image\_tag \}\}\` to the 'build' job definition. Only then does the value flow through to \`needs.build.outputs.image\_tag\` in dependent jobs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T04:02:19.341695+00:00— report_created — created