Skip to content

Commit 6b275bb

Browse files
authored
chore(ci): define workflow token permissions (#79)
* chore(ci): define workflow token permissions Best practice. Also has a minor effect on the OpenSSF scorecard. --------- Signed-off-by: Ville Vesilehto <ville.vesilehto@upcloud.com>
1 parent 8299442 commit 6b275bb

File tree

7 files changed

+39
-1
lines changed

7 files changed

+39
-1
lines changed

.github/workflows/docs.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@ on:
88
- main
99
- test-docs-generator # for testing
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
update:
1316
name: Update
1417
if: github.event.pull_request.merged == true
1518
runs-on: ubuntu-latest
19+
permissions:
20+
pull-requests: write
1621
steps:
1722
- name: Checkout
1823
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

.github/workflows/lint.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
name: Lint
22
on:
33
pull_request:
4+
paths:
5+
- '**.go'
6+
- 'go.mod'
7+
- 'go.sum'
8+
- '.github/workflows/lint.yaml'
9+
permissions:
10+
contents: read
411
jobs:
512
golangci-lint:
613
runs-on: ubuntu-latest

.github/workflows/notify-integration-release-via-manual.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ on:
1212
description: "A branch or SHA"
1313
default: 'main'
1414
required: false
15+
16+
permissions:
17+
contents: read
18+
1519
jobs:
1620
notify-release:
1721
runs-on: ubuntu-latest
22+
permissions:
23+
actions: read
1824
steps:
1925
- name: Checkout this repo
2026
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

.github/workflows/notify-integration-release-via-tag.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@ name: Notify Integration Release (Tag)
22
on:
33
push:
44
tags:
5-
- '*.*.*' # Proper releases
5+
- 'v*.*.*' # Proper releases
6+
7+
permissions:
8+
contents: read
9+
610
jobs:
711
strip-version:
812
runs-on: ubuntu-latest
13+
permissions:
14+
actions: read
915
outputs:
1016
packer-version: ${{ steps.strip.outputs.packer-version }}
1117
steps:

.github/workflows/release.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@ on:
33
push:
44
tags:
55
- "v*"
6+
7+
permissions:
8+
contents: read
9+
610
jobs:
711
goreleaser:
812
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
id-token: write
16+
packages: write
917
steps:
1018
- name: Checkout head
1119
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

.github/workflows/test-plugin-example.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ on:
1616
required: false
1717
default: "./example"
1818

19+
permissions:
20+
contents: read
21+
1922
jobs:
2023
build:
2124
runs-on: ubuntu-latest

.github/workflows/test.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
- main
77
pull_request:
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
test:
1114
strategy:

0 commit comments

Comments
 (0)