How do you create a single required status check for a pipeline with many jobs?
IntermediateConceptJobs, Steps, Matrix & Concurrency
Answer
Add a fan-in job that depends on everything, always runs, and fails if any dependency did not succeed:
ci-ok:
if: always()
needs: [lint, test, build]
runs-on: ubuntu-24.04
steps:
- run: |
echo '${{ toJSON(needs) }}' | jq -e 'all(.[]; .result == "success" or .result == "skipped")'
Make only ci-ok required in branch protection. Matrix renames and new jobs no longer require changing protection settings, and skipped path-filtered jobs do not block merges.
More on Jobs, Steps, Matrix & Concurrency
How does `needs` work, and what happens to a job whose dependency failed or was skipped?BeginnerWhat is the implicit `success()` in a job `if`, and why is `always()` usually the wrong fix?IntermediateWhat values can `needs.<job>.result` take?BeginnerHow does a matrix expand, and how are job names generated?BeginnerHow do `include` and `exclude` work in a matrix?IntermediateWhat do `fail-fast` and `max-parallel` do?Beginner