Skip to content
filter

GitHub Action

Matrix Git generator

v1 Pre-release

Matrix Git generator

filter

Matrix Git generator

A github action that can generate a matrix to run multiple jobs from git changes

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Matrix Git generator

uses: ReyahSolutions/matrix-git-generator@v1

Learn more about this action in ReyahSolutions/matrix-git-generator

Choose a version

Matrix Git generator

With this github actions you can generate a matrix to run multiple jobs from git changes

This github actions has been designed to be used in monorepo where you want to execute jobs for specific folder changes.

Example

name: A simple demonstration
on: push

jobs:
  generate_matrix:
    name: Find services
    runs-on: ubuntu-latest
    outputs:
      matrix: "{\"path\": ${{ steps.generate_matrix.outputs.matrix }} }"
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Generate matrix
        id: generate_matrix
        uses: ReyahSolutions/matrix-git-generator@v1
        with:
          filters: |
            service.*/**

  test_service:
    name: Test service
    runs-on: ubuntu-latest
    needs: [generate_matrix]
    strategy:
      matrix: ${{fromJson(needs.generate_matrix.outputs.matrix)}}
      fail-fast: true 
    steps:
      # [...] Do what ever you want for each match
      - name: Example
        run: |
          cd ${{ matrix.path }}
          make test