-
Notifications
You must be signed in to change notification settings - Fork 1.1k
69 lines (61 loc) · 1.94 KB
/
lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: linter
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
branches:
- "main"
- 'release-**'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
# Required: allow read access to the content for analysis.
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
pull-requests: read
# Optional: Allow write access to checks to allow the action to annotate code in the PR.
checks: write
jobs:
changes:
outputs:
should-run-linting: ${{ steps.changes.outputs.go == 'true' }}
if: github.event.pull_request.draft == false
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
id: changes
with:
filters: |
go:
- '**.go'
- 'go.*'
- '.github/workflows/lint.yml'
- '.golangci.yml'
golangci-lint:
needs: [changes]
if: github.event.pull_request.draft == false && needs.changes.outputs.should-run-linting == 'true'
name: Linting
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
# need to setup go toolchain explicitly
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5
with:
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6
with:
# renovate: datasource=github-releases depName=golangci/golangci-lint
version: v1.59.1
skip-lint:
needs: [changes]
if: needs.changes.outputs.should-run-linting == 'false'
name: Linting
runs-on: ubuntu-24.04
steps:
- run: 'echo "No build required"'