Matrix jobs in GitHub Actions
Answer: Use jobs.<job_id>.strategy.matrix to define a matrix of different job configurations. A job will run for each possible combination of the variables. (S2)
Shaping the matrix
- Specify multiple variables to create a multi-dimensional matrix. (S2)
- To expand existing matrix configurations or to add new configurations, use jobs.<job_id>.strategy.matrix.include. The value of include is a list of objects. (S1)
- To remove specific configurations defined in the matrix, use jobs.<job_id>.strategy.matrix.exclude. (S1)
- You can use the output from one job to define matrices for multiple jobs. (S1)
- A matrix will generate a maximum of 256 jobs per workflow run, for both GitHub-hosted and self-hosted runners. (S2)
Running and failures
- To control how job failures are handled, use jobs.<job_id>.strategy.fail-fast and jobs.<job_id>.continue-on-error. (S1)
- To set the maximum number of jobs that can run simultaneously when using a matrix job strategy, use jobs.<job_id>.strategy.max-parallel. (S1)
- You can allow specific jobs in a job matrix to fail without failing the workflow run. (S2)
- The jobs.<job_id>.if condition is evaluated before jobs.<job_id>.strategy.matrix is applied. (S2)
- Actions does not guarantee the order that matrix jobs will run in. (S2)
Claims
- id: C1 claim: A matrix job runs once per combination of variables. source: S2 evidence: "A job will run for each possible combination of the variables."
- id: C2 claim: include adds or expands matrix configurations. source: S1 evidence: "The value of include is a list of objects."
- id: C3 claim: A matrix generates at most 256 jobs per run. source: S2 evidence: "A matrix will generate a maximum of 256 jobs per workflow run."
- id: C4 claim: The job if condition is evaluated before the matrix is applied. source: S2 evidence: "The jobs.<job_id>.if condition is evaluated before jobs.<job_id>.strategy.matrix is applied."
Sources
- [S1] Running variations of jobs in a workflow - GitHub Docs. GitHub Docs. https://docs.github.com/en/actions/how-tos/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow . License: CC BY 4.0 (github/docs). Accessed 2026-11-04.
- [S2] Workflow syntax for GitHub Actions - GitHub Docs. GitHub Docs. https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax . License: CC BY 4.0 (github/docs). Accessed 2026-11-04.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: GitHub Docs, Running variations of jobs in a workflow - GitHub Docs, CC BY 4.0 (github/docs); GitHub Docs, Workflow syntax for GitHub Actions - GitHub Docs, CC BY 4.0 (github/docs).
Cite this
iinventedlight. 2026. "Matrix jobs in GitHub Actions." iinventedlight Library, iil:note:14hr8d06, version of 2026-11-04. https://iinventedlight.com/library/notes/github-actions-matrix/. License: CC-BY-4.0.
@misc{iil_note_14hr8d06,
author = {{iinventedlight}},
title = {{Matrix jobs in GitHub Actions}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-04},
url = {https://iinventedlight.com/library/notes/github-actions-matrix/},
note = {Permanent ID iil:note:14hr8d06. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.
For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/github-actions-matrix.md.