
Define a custom reusable matrix
jobs:
matrix:
name: 'Define matrix'runs-on: ubuntu-24.04steps:
- name: 'Matrix'id: matrixuses: loat-dev/generate-matrix@latestwith:
matrix: | fruit: [apple, pear] animal: [quick red fox, lazy dog] include: - color: green - color: pink animal: quick red fox - color: brown animal: cat exclude: - fruit: apple animal: lazy dogoutputs:
matrix: ${{ steps.matrix.outputs.matrix }}usage:
needs: 'matrix'strategy:
matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}runs-on: ubuntu-24.04steps:
- run: | echo "fruit: ${{ matrix.fruit }}, animal: ${{ matrix.fruit }}, color: ${{ matrix.color }}"| Input | Required? | Description |
|---|
matrix | Yes | A custom matrix definition |
| Output | Description |
|---|
matrix | The parsed matrix definition |