How do `include` and `exclude` work in a matrix?
IntermediateConceptJobs, Steps, Matrix & Concurrency
Answer
exclude removes combinations matching all listed keys. include either adds keys to existing combinations that match (without overwriting original values) or, if it matches none, adds a new standalone combination. Exclusions are processed before inclusions.
matrix:
os: [ubuntu-24.04, windows-2025]
node: [20, 22]
exclude:
- { os: windows-2025, node: 20 }
include:
- { node: 22, coverage: true } # adds coverage to both node 22 legs
- { os: macos-15, node: 22 } # new extra leg
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?BeginnerWhat do `fail-fast` and `max-parallel` do?BeginnerHow do you build a matrix dynamically from a previous job?Advanced