Skip to content

Commit

Permalink
ci: check for go mod tidy (#741)
Browse files Browse the repository at this point in the history
This ensures that go.mod is always tidied.
  • Loading branch information
phm07 committed Apr 25, 2024
1 parent 42d9328 commit 5083734
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,23 @@ jobs:

- if: failure()
run: echo "::error::Check failed, please run 'go generate ./...' and commit the changes."

go-mod-tidy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Run go mod tidy
run: go mod tidy

- name: Check uncommitted changes
run: git diff --exit-code

- if: failure()
run: echo "::error::Check failed, please run 'go mod tidy' and commit the changes."
3 changes: 2 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>hetznercloud/.github//renovate/default"]
"extends": ["github>hetznercloud/.github//renovate/default"],
"postUpdateOptions": ["gomodTidy"]
}

0 comments on commit 5083734

Please sign in to comment.