Interview Prep/CI/CD/GitHub Actions

How do `needs` and job dependencies work, and what happens when a needed job is skipped?

IntermediateConceptGitHub Actions
Answer

needs: [a, b] makes a job wait for both. If a needed job fails or is skipped, the dependent job is skipped by default. To run a job regardless, use if: always() or if: ${{ !cancelled() }} and inspect needs.<job>.result (success, failure, cancelled, skipped).

notify:
  needs: [build, deploy]
  if: always()
  runs-on: ubuntu-latest
  steps:
    - run: echo "deploy was ${{ needs.deploy.result }}"
All CI/CD questions

More on GitHub Actions