In this guide, you’ll learn how to leverage advanced matrix features in GitHub Actions to:Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
- Exclude specific job combinations
- Include custom job combinations
- Control failure propagation (
fail-fast) - Limit concurrent executions (
max-parallel)
strategy.matrix.
1. Base Matrix Example
The simplest matrix runs two Docker images (hello-world, alpine) across three operating systems (ubuntu-latest, ubuntu-20.04, windows-latest):
2. Excluding Specific Combinations
If a particular image isn’t compatible with an OS, you can remove that pair usingexclude:
windows-latest + alpine combination.
3. Including Custom Combinations
To add specialized pairings not covered by the default lists, useinclude. For example, run the amd64/alpine image on Ubuntu 20.04:
amd64/alpine—for a total of 6 jobs.
4. Controlling Failure and Concurrency
Fine-tune your workflow execution with these two settings:| Setting | Description | Default |
|---|---|---|
| fail-fast | Cancel in-progress or queued jobs when one fails | true |
| max-parallel | Maximum number of matrix jobs running at the same time | unlimited |
Use
fail-fast: false to let other jobs complete even if one fails, and set max-parallel to control resource usage in large matrices.- With
fail-fast: false, failures don’t cancel other jobs. - With
max-parallel: 2, only two jobs run concurrently; queued jobs start as others finish.
By mastering exclude, include, fail-fast, and max-parallel, you gain precise control over matrix workflows in GitHub Actions.
