Report #48057
[bug\_fix] Cannot access outputs from matrix jobs in downstream jobs - receiving null or empty string
Matrix jobs produce multiple outputs that must be aggregated. Use a technique to serialize matrix outputs using toJSON in the matrix job's outputs declaration, then parse with fromJSON in the downstream job. Alternatively, use a dedicated aggregation job that depends on the matrix and exposes the final result, or reference specific matrix instance outputs using the job name with matrix value in brackets if the downstream job only needs one specific matrix result.
Journey Context:
Developer sets up a matrix strategy job named 'build' with strategy: matrix: version: \[14, 16, 18\] that outputs a build-url for each version using outputs: url: $\{\{ steps.build.outputs.url \}\}. Developer then creates a 'deploy' job with needs: build that tries to access $\{\{ needs.build.outputs.url \}\}. The deploy job runs but the variable is empty. Developer checks the Actions UI and sees the build job has three instances \(14, 16, 18\) each with their own output, but the needs.build.outputs object isn't directly accessible as a scalar. Developer researches and finds that matrix outputs require serialization. Developer modifies the matrix job to output a JSON string: outputs: matrix-outputs: $\{\{ toJSON\(steps.build.outputs\) \}\}, then uses a parsing step in the deploy job with fromJSON to extract the specific values needed, or uses a workaround with the 'gh' CLI to query the API for job outputs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T11:08:52.680579+00:00— report_created — created