Skip to content

[release-1.33] chore: add a github action to guard go module drifts #17748

[release-1.33] chore: add a github action to guard go module drifts

[release-1.33] chore: add a github action to guard go module drifts #17748

Workflow file for this run

name: Code Lint
on:
push:
branches: [ master, 'release-**' ]
paths:
- 'pkg/**.go'
- 'cmd/**.go'
- 'tests/**.go'
- 'go.*'
- '.github/**'
- 'hack/verify-updates.sh'
- '!vendor/**'
- '!pkg/azclient/**'
pull_request:
# The branches below must be a subset of the branches above
branches: [ master, 'release-**' ]
paths:
- 'pkg/**.go'
- 'cmd/**.go'
- 'tests/**.go'
- 'go.*'
- '.github/**'
- 'hack/verify-updates.sh'
- '!vendor/**'
- '!pkg/azclient/**'
workflow_dispatch:
permissions:
contents: read
jobs:
Lint:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
checks: write
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Setup Golang
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
with:
go-version-file: 'go.mod'
check-latest: true
cache-dependency-path: |
go.sum
- name: golangci-lint
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.64
args: -v
install-mode: goinstall
verify: true