Interview Prep/GitHub Actions/Custom Actions & Reusable Workflows

Can a reusable workflow be used with a matrix?

IntermediateConceptCustom Actions & Reusable Workflows
Answer

Yes, the calling job can have strategy.matrix, and each leg calls the reusable workflow with different inputs:

jobs:
  deploy:
    strategy:
      matrix:
        env: [dev, staging]
    uses: ./.github/workflows/deploy.yml
    with:
      environment: ${{ matrix.env }}

Outputs from a matrix of reusable workflow calls follow the same last-writer-wins rule as normal matrix jobs.

All GitHub Actions questions Roadmap: GitHub Actions

More on Custom Actions & Reusable Workflows