GitHub Actions matrix continue-on-error per leg not behaving as expected in CI
To let only certain matrix legs fail without failing the whole run, drive continue-on-error from the matrix context, for example an experimental include flag. A blanket continue-on-error: true masks failures on every leg, not just the ones you meant.
What this error means
Either every matrix leg is allowed to fail (masking real breakage), or the experimental leg you wanted to tolerate still fails the run because continue-on-error was not wired to the matrix.
strategy:
matrix:
node: [18, 20]
include:
- node: 21
experimental: true
# without continue-on-error tied to matrix.experimental, node 21 failing fails the runCommon causes
continue-on-error applied to all legs
Setting continue-on-error: true at job level tolerates failures across the entire matrix, hiding genuine regressions.
The tolerated leg is not flagged
Without a matrix flag (like experimental) to key on, there is no way to allow only one combination to fail.
How to fix it
Drive continue-on-error from a matrix flag
- Add an
experimentalfield viaincludeto the legs you want to tolerate. - Set
continue-on-errorfrom that flag. - Legs without the flag still fail the run on error.
jobs:
test:
continue-on-error: ${{ matrix.experimental == true }}
strategy:
matrix:
node: [18, 20]
include:
- node: 21
experimental: trueKeep non-experimental legs strict
Ensure the default (no flag) evaluates to false so real failures on supported combinations still fail the build.
How to prevent it
- Tie continue-on-error to a matrix flag, not the whole job.
- Flag only the legs that are genuinely allowed to fail.
- Keep supported combinations strict so regressions surface.