Skip to content

Commit dfbde80

Browse files
authored
ci: harden permissions and update golangci-lint version in release workflow (#177)
* ci: harden permissions * ci: update `golangci-lint` version in release workflow
1 parent 80cd52f commit dfbde80

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed

.github/workflows/checks.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,17 @@ on:
99
env:
1010
GO_VERSION: '1.17.9'
1111

12+
permissions:
13+
contents: read # to fetch code (actions/checkout)
14+
1215
jobs:
1316
test-ubuntu:
1417
name: Test on Ubuntu
1518
runs-on: ubuntu-latest
1619
steps:
1720
- uses: actions/checkout@v3
21+
with:
22+
persist-credentials: false
1823
- uses: actions/setup-go@v3
1924
with:
2025
go-version: ${{ env.GO_VERSION }}
@@ -26,6 +31,8 @@ jobs:
2631
runs-on: macos-latest
2732
steps:
2833
- uses: actions/checkout@v3
34+
with:
35+
persist-credentials: false
2936
- uses: actions/setup-go@v3
3037
with:
3138
go-version: ${{ env.GO_VERSION }}
@@ -37,6 +44,8 @@ jobs:
3744
runs-on: windows-latest
3845
steps:
3946
- uses: actions/checkout@v3
47+
with:
48+
persist-credentials: false
4049
- uses: actions/setup-go@v3
4150
with:
4251
go-version: ${{ env.GO_VERSION }}
@@ -48,6 +57,8 @@ jobs:
4857
steps:
4958
- name: Checkout
5059
uses: actions/checkout@v3
60+
with:
61+
persist-credentials: false
5162

5263
- uses: actions/setup-go@v3
5364
with:
@@ -62,13 +73,17 @@ jobs:
6273
steps:
6374
- name: Checkout
6475
uses: actions/checkout@v3
76+
with:
77+
persist-credentials: false
6578

6679
- run: make lint-with-go-fmt
6780
prettier:
6881
runs-on: ubuntu-latest
6982
steps:
7083
- name: Checkout
7184
uses: actions/checkout@v3
85+
with:
86+
persist-credentials: false
7287

7388
- uses: actions/setup-node@v3
7489

.github/workflows/release.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@ on:
88
env:
99
GO_VERSION: '1.17.9'
1010

11+
permissions:
12+
contents: read # to fetch code (actions/checkout)
13+
1114
jobs:
1215
test-ubuntu:
1316
name: Test on Ubuntu
1417
runs-on: ubuntu-latest
1518
steps:
1619
- uses: actions/checkout@v3
20+
with:
21+
persist-credentials: false
1722
- uses: actions/setup-go@v3
1823
with:
1924
go-version: ${{ env.GO_VERSION }}
@@ -25,6 +30,8 @@ jobs:
2530
runs-on: macos-latest
2631
steps:
2732
- uses: actions/checkout@v3
33+
with:
34+
persist-credentials: false
2835
- uses: actions/setup-go@v3
2936
with:
3037
go-version: ${{ env.GO_VERSION }}
@@ -36,6 +43,8 @@ jobs:
3643
runs-on: windows-latest
3744
steps:
3845
- uses: actions/checkout@v3
46+
with:
47+
persist-credentials: false
3948
- uses: actions/setup-go@v3
4049
with:
4150
go-version: ${{ env.GO_VERSION }}
@@ -45,8 +54,9 @@ jobs:
4554
golangci-lint:
4655
runs-on: ubuntu-latest
4756
steps:
48-
- name: Checkout
49-
uses: actions/checkout@v3
57+
- uses: actions/checkout@v3
58+
with:
59+
persist-credentials: false
5060

5161
- uses: actions/setup-go@v3
5262
with:
@@ -55,12 +65,13 @@ jobs:
5565
- name: Run golangci-lint
5666
uses: golangci/golangci-lint-action@v3
5767
with:
58-
version: v1.44
68+
version: v1.47
5969
go-fmt:
6070
runs-on: ubuntu-latest
6171
steps:
62-
- name: Checkout
63-
uses: actions/checkout@v3
72+
- uses: actions/checkout@v3
73+
with:
74+
persist-credentials: false
6475

6576
- run: make lint-with-go-fmt
6677
goreleaser:
@@ -71,6 +82,8 @@ jobs:
7182
- test-windows
7283
- golangci-lint
7384
- go-fmt
85+
permissions:
86+
contents: write # to create a GitHub release (goreleaser/goreleaser-action)
7487
steps:
7588
- uses: actions/checkout@v3
7689
- run: git fetch --prune --unshallow

0 commit comments

Comments
 (0)