Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github Action use matrices with reuse-able workflow

I've been rooting through the Github Action documentation around re-useable workflows and am attempting to piece together a chain of matrices.

My pseudo workflow looks something like the following steps.

  • Job 1: Figure out files changed under a path & output them as json
  • Job 2: Iterate the file list as a matrix and invoke another workflow.
  • Job 3 (in other workflow): Simply use another matrix definition in conjunction with the single input value to perform a set of steps.

It would seem a relatively simple objective. Yet it looks like workflow re-useable calls do not support strategy. Correct me if I'm wrong?

like image 495
David Avatar asked Jun 08 '26 13:06

David


1 Answers

GitHub Actions matrix supports now reusable workflows (since 22.08.22):

jobs:
  ReuseableMatrixJobForDeployment:
    strategy:
      matrix:
        target: [dev, stage, prod]
    uses: octocat/octo-repo/.github/workflows/deployment.yml@main
    with:
      target: ${{ matrix.target }}

References:

  • GitHub Actions: Improvements to reusable workflows
  • Using a matrix strategy with a reusable workflow
like image 144
Nick Baum Avatar answered Jun 10 '26 11:06

Nick Baum