Skip to content

fix(ci): use dynamic matrix for macOS-on-main-only#490

Merged
CSRessel merged 1 commit into
mainfrom
fix/ci-matrix-conditional
May 24, 2026
Merged

fix(ci): use dynamic matrix for macOS-on-main-only#490
CSRessel merged 1 commit into
mainfrom
fix/ci-matrix-conditional

Conversation

@nori-sessions
Copy link
Copy Markdown
Contributor

@nori-sessions nori-sessions Bot commented May 24, 2026

Summary

  • Fixes Unrecognized named-value: 'matrix' error in rust-ci.yml introduced by ci: migrate to Blacksmith runners #487
  • The matrix context is not available in job-level if conditions in GitHub Actions — it's only available for name, runs-on, env, and step-level expressions
  • Replaces the static matrix + broken job-level if with a dynamic fromJSON matrix that conditionally includes the macOS entry only on non-PR events

What changed

Before (broken):

if: ${{ !matrix.main-only || github.event_name != 'pull_request' }}
strategy:
  matrix:
    include:
      - runner: blacksmith-4vcpu-ubuntu-2404
        main-only: false
      - runner: blacksmith-6vcpu-macos-15
        main-only: true

After (fixed):

strategy:
  matrix:
    include: ${{ github.event_name != 'pull_request'
      && fromJSON('[{linux}, {macos}]')
      || fromJSON('[{linux}]') }}

Same behavior: PRs get Linux-only CI, pushes to main get both Linux + macOS.

Test plan

  • PR CI triggers Linux checks only (no macOS entry in matrix)
  • Merge to main triggers both Linux + macOS checks

The `matrix` context is not available in job-level `if` conditions in
GitHub Actions, causing "Unrecognized named-value: 'matrix'" errors.

Replace the static matrix + job-level `if` with a dynamic `fromJSON`
matrix that conditionally includes the macOS entry only on non-PR events.

🤖 Generated with [Nori](https://noriagentic.com)

Co-Authored-By: Nori <contact@tilework.tech>
🤖 Generated with [Nori](https://noriagentic.com)

Co-Authored-By: Nori <contact@tilework.tech>
@CSRessel CSRessel merged commit 8f5718e into main May 24, 2026
2 checks passed
@CSRessel CSRessel deleted the fix/ci-matrix-conditional branch May 24, 2026 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant