Skip to content

Commit

Permalink
Add CI job that makes sure that go mod tidy is run (#2032)
Browse files Browse the repository at this point in the history
This re-uses the `golangci-lint.yml` file and renames it `lint.yml`.

Now it runs lint AND go mod tidy verification, it'll probably hold more lint
commands in the future.
  • Loading branch information
JAORMX authored Dec 22, 2023
1 parent a966cd3 commit bb3812c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: golangci-lint
name: Lint
on:
workflow_call:
permissions:
Expand All @@ -19,3 +19,20 @@ jobs:
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3
with:
version: v1.55.2

mod-tidy:
name: Go mod tidy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5
with:
go-version-file: 'go.mod'
cache: false
- name: go mod tidy
run: go mod tidy
- name: git diff
run: git diff --exit-code
- name: Output message
if: ${{ failure() }}
run: echo "Please run 'go mod tidy' and commit changes"
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ permissions:
jobs:
license-check:
uses: ./.github/workflows/license-check.yml
golangci-lint:
uses: ./.github/workflows/golangci-lint.yml
lint:
uses: ./.github/workflows/lint.yml
build:
uses: ./.github/workflows/build.yml
test:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ permissions:
jobs:
license-check:
uses: ./.github/workflows/license-check.yml
golangci-lint:
uses: ./.github/workflows/golangci-lint.yml
lint:
uses: ./.github/workflows/lint.yml
build:
uses: ./.github/workflows/build.yml
test:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ permissions:
jobs:
license-check:
uses: ./.github/workflows/license-check.yml
golangci-lint:
uses: ./.github/workflows/golangci-lint.yml
lint:
uses: ./.github/workflows/lint.yml
build:
uses: ./.github/workflows/build.yml
test:
Expand Down

0 comments on commit bb3812c

Please sign in to comment.