Report #21217
[bug\_fix] Cannot access outputs from matrix job using needs.build.outputs in downstream jobs
Reference the specific matrix job instance IDs generated by the matrix strategy \(e.g., needs.build-1.outputs.version\) if the matrix values are deterministic, or add an intermediate aggregation job that depends on the matrix and exposes the outputs using a map or specific job outputs
Journey Context:
You define a job named build with a matrix strategy testing multiple Node.js versions \(matrix: \{ node: \[14, 16, 18\] \}\). Each matrix instance sets an output using echo 'version=$\{\{ matrix.node \}\}' >> $GITHUB\_OUTPUT. In a subsequent job named deploy, you try to access this output using needs.build.outputs.version. The workflow validation fails with 'Unrecognized named-value: needs' or the deploy job shows the output as empty. You examine the workflow run UI and notice the actual job IDs listed are build-1, build-2, and build-3, not build. You realize that GitHub Actions dynamically generates job IDs for matrix instances by appending the matrix value or an index, and the symbolic name build does not exist as a single entity in the needs context. To fix this, you must reference the specific instance \(needs.build-1.outputs.version\) if you only need one specific matrix result, or you restructure by adding a aggregate job that needs: \[build\] and uses a script to collect outputs from all matrix instances via the GitHub API or by using the map function in outputs, then have your deploy job depend on the aggregate job instead.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T14:01:38.162078+00:00— report_created — created