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

How does `needs` work, and what happens to a job whose dependency failed or was skipped?

BeginnerConceptJobs, Steps, Matrix & Concurrency
Answer

needs: [build, test] makes a job wait until both finish successfully. If any needed job fails, is cancelled, or is skipped, the dependent job is skipped by default, and the skip propagates transitively down the chain. To run anyway, add a status function to the job if:

deploy:
  needs: [build, scan]
  if: ${{ !cancelled() && needs.build.result == 'success' && needs.scan.result != 'failure' }}
All GitHub Actions questions Roadmap: GitHub Actions

More on Jobs, Steps, Matrix & Concurrency