From b045b12e36817884e96af2b1139136ce17e645d3 Mon Sep 17 00:00:00 2001 From: Devin Buhl Date: Thu, 28 Dec 2023 08:56:43 -0500 Subject: [PATCH] fix: update flux-diff workflow to use container Signed-off-by: Devin Buhl --- .github/workflows/flux-diff.yaml | 45 +++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/.github/workflows/flux-diff.yaml b/.github/workflows/flux-diff.yaml index 26a69a72..75d7b3f2 100644 --- a/.github/workflows/flux-diff.yaml +++ b/.github/workflows/flux-diff.yaml @@ -19,22 +19,47 @@ jobs: pull-requests: write strategy: matrix: - path: ["kubernetes"] - resource: ["helmrelease", "kustomization"] + paths: ["kubernetes"] + resources: ["helmrelease", "kustomization"] steps: - - name: Diff Resources - uses: allenporter/flux-local/action/diff@4.2.1 - id: diff + - name: Checkout Default Branch + uses: actions/checkout@v4 with: - sources: home-kubernetes - path: "${{ matrix.path }}" - resource: "${{ matrix.resource }}" + ref: "${{ github.event.repository.default_branch }}" + path: default + + - name: Checkout Pull Request Branch + uses: actions/checkout@v4 + with: + path: pull + + - name: Diff Resources + uses: docker://ghcr.io/allenporter/flux-local:main + with: + args: >- + diff ${{ matrix.resources }} + --unified 6 + --path-orig /github/workspace/default/${{ matrix.paths }} + --path /github/workspace/pull/${{ matrix.paths }} + --strip-attrs "helm.sh/chart,checksum/config,app.kubernetes.io/version,chart" + --limit-bytes 10000 + --all-namespaces + --sources "home-kubernetes" + --output-file diff.patch + + - name: Generate Diff + id: diff + run: | + cat diff.patch + echo "diff<> $GITHUB_OUTPUT + cat diff.patch >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT - if: ${{ steps.diff.outputs.diff != '' }} name: Add comment - uses: mshick/add-pr-comment@v2 + uses: mshick/add-pr-comment@v2.8.1 with: - message-id: "${{ github.event.pull_request.number }}/${{ matrix.path }}/${{ matrix.resource }}" + message-id: "${{ github.event.pull_request.number }}/${{ matrix.paths }}/${{ matrix.resources }}" message-failure: Diff was not successful message: | ```diff