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

How do you make a job that only runs after a matrix job if all legs passed, and another that runs if any leg failed?

IntermediateConceptJobs, Steps, Matrix & Concurrency
Answer

needs on a matrix job waits for all legs, and result is aggregated.

publish:
  needs: test            # implicit success(): all legs passed
notify:
  needs: test
  if: ${{ failure() }}   # any leg failed
  runs-on: ubuntu-24.04
  steps:
    - run: echo "Tests failed on run ${{ github.run_id }}"
All GitHub Actions questions Roadmap: GitHub Actions

More on Jobs, Steps, Matrix & Concurrency