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.
More on Custom Actions & Reusable Workflows
What are the three kinds of custom action and how do you choose?BeginnerWrite a minimal composite action that installs Node and dependencies with caching.IntermediateWhat can a composite action not do compared to a job?IntermediateHow do you pass outputs out of a composite action?IntermediateWhat does `action.yml` contain for a JavaScript action?IntermediateWhy must a JavaScript action commit its `dist/` or `node_modules`?Intermediate