Interview Prep/GitHub Actions/Jobs, Steps, Matrix & Concurrency

Can a matrix job produce outputs for downstream jobs?

AdvancedConceptJobs, Steps, Matrix & Concurrency
Answer

Job outputs from a matrix are not merged; all legs write the same output name and the last one to finish wins, which is nondeterministic. Patterns that work:

  • Output names are static, so legs cannot write digest-${{ matrix.arch }} as separate outputs. Instead each leg uploads an artifact named per leg (digest-amd64, digest-arm64), and a fan-in job downloads them with pattern: digest-* and merge-multiple: true.
  • Or write results to a store (S3, a check run, a PR comment) keyed by the matrix value.
All GitHub Actions questions Roadmap: GitHub Actions

More on Jobs, Steps, Matrix & Concurrency