Interview Prep/GitHub Actions/Pipeline Design & Triggers

You must support Node 20, 22 and 24 on Linux, plus Node 22 on Windows only. Write the matrix.

BeginnerScenarioPipeline Design & Triggers
Answer

Situation read → Base matrix plus a standalone extra combination.

What I'd do →

  1. Define the matrix:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-24.04]
        node: [20, 22, 24]
        include:
          - os: windows-2025
            node: 22
    runs-on: ${{ matrix.os }}
    
  2. Use shell: bash for scripts so they run on Windows (Git Bash) too.

Why → include with a combination that matches nothing adds a new leg, keeping the matrix minimal.

Interview tip → fail-fast: false so a Windows-only failure does not hide Linux results.

All GitHub Actions questions Roadmap: GitHub Actions

More on Pipeline Design & Triggers