From 98e3650fd1a0bf7731d1ecaa95dc54b95fbb105a Mon Sep 17 00:00:00 2001 From: Gergely Brautigam <182850+Skarlso@users.noreply.github.com> Date: Fri, 2 Aug 2024 16:46:34 +0200 Subject: [PATCH] feat: add check for diffs after go mod tidy and generate (#861) #### What this PR does / why we need it: #### Which issue(s) this PR fixes: --- .github/workflows/check_diff_action.yaml | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/check_diff_action.yaml diff --git a/.github/workflows/check_diff_action.yaml b/.github/workflows/check_diff_action.yaml new file mode 100644 index 000000000..af23c3c70 --- /dev/null +++ b/.github/workflows/check_diff_action.yaml @@ -0,0 +1,34 @@ +name: Check for diff after go mod tidy and generated targets + +on: + pull_request: {} + +jobs: + diff-check-manifests: + name: Check for diff + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: '${{ github.workspace }}/go.mod' + - name: Restore Go cache + uses: actions/cache@v4 + with: + path: /home/runner/work/_temp/_github_home/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Make generate and deepcopy + run: | + make -f hack/Makefile mdref && make -f hack/Makefile go-bindata && make generate && make generate-deepcopy + - name: go mod tidy + run: | + go mod tidy + - name: Check for diff + run: | + git diff --exit-code --shortstat