Skip to content

Commit bd2bdde

Browse files
committed
separate linter job in Github Actions
pulls out the golangci-lint job from the main go.yml Github Action and into its own workflow that follows security best practices like ensuring read-only permissions and using SHA-specific Action releases. Signed-off-by: Jay Pipes <jaypipes@gmail.com>
1 parent cb7b061 commit bd2bdde

File tree

2 files changed

+33
-13
lines changed

2 files changed

+33
-13
lines changed

.github/workflows/go.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,6 @@ on:
88

99
# see: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
1010
jobs:
11-
# tier 0: system-independent checks
12-
lint:
13-
runs-on: ubuntu-latest
14-
steps:
15-
- name: Check out code
16-
uses: actions/checkout@v2
17-
18-
- name: Verify
19-
uses: golangci/golangci-lint-action@v2
20-
with:
21-
version: v1.41.1
22-
args: --timeout=15m0s --verbose
23-
2411
# tier-1
2512
# main development platform, gets features first and it's most tested
2613
build-ubuntu-2204:

.github/workflows/lint.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: lint
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
permissions:
10+
contents: read
11+
pull-requests: read # needed for only-new-issues option below
12+
13+
jobs:
14+
fmtcheck:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: harden runner
18+
uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1
19+
with:
20+
egress-policy: block
21+
disable-sudo: true
22+
- name: checkout code
23+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
24+
- name: setup go
25+
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
26+
with:
27+
go-version: 1.19
28+
- name: lint
29+
uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # v3.6.0
30+
with:
31+
version: v1.53
32+
args: --timeout=5m0s --verbose
33+
only-new-issues: true

0 commit comments

Comments
 (0)