Report #41126
[bug\_fix] Cannot aggregate outputs from matrix jobs in downstream non-matrix jobs
Use a separate 'aggregator' job that depends on the matrix job, reads the outputs using \`fromJSON\` or shell processing of the \`needs\` context array, and re-exports the combined result. Root cause: When a matrix job produces outputs, the \`needs\` context for that job becomes an array of objects \(one per matrix instance\), which cannot be directly accessed via \`needs.job.outputs\` in a non-matrix downstream job.
Journey Context:
You have a 'test' job with a matrix strategy testing your app on Node 16, 18, and 20. Each matrix instance outputs a coverage file path via \`echo "path=coverage/$\{\{ matrix.node \}\}.json" >> $GITHUB\_OUTPUT\`. You want a final 'report' job that collects all these paths and uploads a combined report. You try to access \`$\{\{ needs.test.outputs.path \}\}\` in the report job, but the value is empty or the workflow fails validation. You check the documentation and realize that for matrix jobs, the \`needs\` context contains an array of results. You create an intermediate 'aggregate' job that depends on the test job, uses a shell script to iterate over \`echo '$\{\{ toJSON\(needs.test.outputs\) \}\}'\` or accesses specific indices like \`needs.test.outputs\['path'\]\` \(which actually doesn't work directly\), and reconstructs the data into a single JSON output that the final report job can consume.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T23:30:04.096622+00:00— report_created — created