Skip to content

Commit

Permalink
Fix linting in CI for new issues (#14335)
Browse files Browse the repository at this point in the history
  • Loading branch information
chainchad authored Sep 4, 2024
1 parent 3ba567d commit 8853040
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
14 changes: 7 additions & 7 deletions .github/actions/golangci-lint/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ inputs:
required: true
go-directory:
description: Go directory to run commands from
default: "."
# XXX: Don't use `.` here due to issues with the golangci-lint-action.
default: ""
# setup-go inputs
only-modules:
description: Set to 'true' to only cache modules
Expand All @@ -36,6 +37,9 @@ runs:
using: composite
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
# We only need a full clone on merge_group events for golangci-lint.
fetch-depth: ${{ github.event_name == 'merge_group' && '0' || '1' }}"
- name: Setup Go
uses: ./.github/actions/setup-go
with:
Expand All @@ -51,13 +55,9 @@ runs:
shell: bash
run: go build ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0
uses: golangci/golangci-lint-action@38e1018663fa5173f3968ea0777460d3de38f256 # v5.3.0
with:
version: v1.59.1
# We already cache these directories in setup-go
skip-pkg-cache: true
skip-build-cache: true
# only-new-issues is only applicable to PRs, otherwise it is always set to false
version: v1.60.3
only-new-issues: true
args: --out-format colored-line-number,checkstyle:golangci-lint-report.xml
working-directory: ${{ inputs.go-directory }}
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ jobs:
# We don't directly merge dependabot PRs, so let's not waste the resources
if: ${{ (github.event_name == 'pull_request' || github.event_name == 'schedule') && github.actor != 'dependabot[bot]' }}
name: lint
permissions:
# For golangci-lint-actions to annotate code in the PR.
checks: write
contents: read
# For golangci-lint-action's `only-new-issues` option.
pull-requests: read
runs-on: ubuntu22.04-8cores-32GB
needs: [filter]
steps:
Expand All @@ -70,6 +76,7 @@ jobs:
gc-basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
gc-host: ${{ secrets.GRAFANA_INTERNAL_HOST }}
gc-org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}

- name: Notify Slack
if: ${{ failure() && github.event.schedule != '' }}
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/ci-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ jobs:
# We don't directly merge dependabot PRs, so let's not waste the resources
if: ${{ (github.event_name == 'pull_request' || github.event_name == 'schedule') && github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
permissions:
# For golangci-lint-actions to annotate code in the PR.
checks: write
contents: read
# For golangci-lint-action's `only-new-issues` option.
pull-requests: read
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: Golang Lint
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ pnpm 9.4.0
postgres 15.1
helm 3.10.3
zig 0.11.0
golangci-lint 1.59.1
golangci-lint 1.60.3
protoc 25.1

0 comments on commit 8853040

Please sign in to comment.