fix: Lint fixes 047 #8515
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint | |
# **What it does**: Runs go linter when go files have been modified | |
# and proto linters when proto files have been modified. | |
# | |
# **Why we have it**: Ensures all go files and proto files are | |
# properly formatted according to lint configuration files. | |
# | |
# **What does it impact**: Code quality. | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- release/v* | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
golangci: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: read # for technote-space/get-diff-action to get git reference | |
strategy: | |
matrix: | |
module: ["app", "types", "x/data", "x/ecocredit", "x/intertx"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: technote-space/get-diff-action@v6 | |
id: git-diff-app | |
with: | |
PATTERNS: | | |
app/**/**.go | |
go.mod | |
go.sum | |
if: matrix.module == 'app' | |
- uses: technote-space/get-diff-action@v6 | |
id: git-diff-types | |
with: | |
PATTERNS: | | |
types/**/**.go | |
types/go.mod | |
types/go.sum | |
if: matrix.module == 'types' | |
- uses: technote-space/get-diff-action@v6 | |
id: git-diff-data | |
with: | |
PATTERNS: | | |
x/data/**/**.go | |
x/data/go.mod | |
x/data/go.sum | |
if: matrix.module == 'x/data' | |
- uses: technote-space/get-diff-action@v6 | |
id: git-diff-ecocredit | |
with: | |
PATTERNS: | | |
x/ecocredit/**/**.go | |
x/ecocredit/go.mod | |
x/ecocredit/go.sum | |
if: matrix.module == 'x/ecocredit' | |
- uses: technote-space/get-diff-action@v6 | |
id: git-diff-intertx | |
with: | |
PATTERNS: | | |
x/intertx/**/**.go | |
x/intertx/go.mod | |
x/intertx/go.sum | |
if: matrix.module == 'x/intertx' | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
if: env.GIT_DIFF | |
- uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.55 | |
working-directory: "." | |
if: steps.git-diff-app.outputs.diff | |
- uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.55 | |
working-directory: "types" | |
if: steps.git-diff-types.outputs.diff | |
- uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.55 | |
working-directory: "x/data" | |
if: steps.git-diff-data.outputs.diff | |
- uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.55 | |
working-directory: "x/ecocredit" | |
if: steps.git-diff-ecocredit.outputs.diff | |
- uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.55 | |
working-directory: "x/intertx" | |
if: steps.git-diff-intertx.outputs.diff | |
buf-lint: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: read # for technote-space/get-diff-action to get git reference | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: technote-space/get-diff-action@v6 | |
id: git-diff-proto | |
with: | |
PATTERNS: | | |
**/**.proto | |
- uses: bufbuild/buf-setup-action@v1 | |
if: steps.git-diff-proto.outputs.diff | |
- uses: bufbuild/buf-lint-action@v1 | |
with: | |
input: 'proto' | |
if: steps.git-diff-proto.outputs.diff | |
protolint: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: read # for technote-space/get-diff-action to get git reference | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: technote-space/get-diff-action@v6 | |
id: git-diff-proto | |
with: | |
PATTERNS: | | |
**/**.proto | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
if: steps.git-diff-proto.outputs.diff | |
- name: Run protolint | |
run: | | |
go install github.com/yoheimuta/protolint/cmd/protolint@latest | |
protolint . | |
if: steps.git-diff-proto.outputs.diff |