From adb9923f11e57040224189b43c673f3eb8ee2935 Mon Sep 17 00:00:00 2001 From: Juan Calderon-Perez <835733+gaby@users.noreply.github.com> Date: Wed, 15 Nov 2023 07:50:48 -0500 Subject: [PATCH] Support for dynamic golangci-lint matrix --- .github/workflows/golangci-lint.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 41e66a23..6ec9770d 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -20,8 +20,23 @@ on: - ".github/dependabot.yml" jobs: - golangci-lint: + prepare-matrix: runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: Fetch Repository + uses: actions/checkout@v4 + - id: set-matrix + run: | + echo "::set-output name=matrix::$(find . -type d -not -path '*/\.*' | jq -R -s -c 'split("\n")[:-1]')" + + golangci-lint: + needs: prepare-matrix + runs-on: ubuntu-latest + strategy: + matrix: + directory: ${{fromJson(needs.prepare-matrix.outputs.matrix)}} steps: - name: Fetch Repository uses: actions/checkout@v4 @@ -29,3 +44,4 @@ jobs: uses: reviewdog/action-golangci-lint@v2 with: golangci_lint_flags: "--tests=false" + working-directory: ${{ matrix.directory }}