Skip to content

Commit 97fda62

Browse files
authored
ci: reduce permissions for GitHub Actions (#112)
1 parent c8bf33b commit 97fda62

File tree

7 files changed

+30
-1
lines changed

7 files changed

+30
-1
lines changed

.github/workflows/check-goreleaser-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ concurrency:
1717
group: ${{ github.workflow }}-${{ github.ref }}
1818
cancel-in-progress: true
1919

20+
# Ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
21+
permissions:
22+
contents: read
23+
2024
jobs:
2125

2226
checkGoReleaserConfig:

.github/workflows/format-go.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ concurrency:
1818
group: ${{ github.workflow }}-${{ github.ref }}
1919
cancel-in-progress: true
2020

21+
# Ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
22+
permissions:
23+
contents: read
24+
2125
jobs:
2226

2327
validateCodeFormatGo:

.github/workflows/lint-github-actions.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ concurrency:
2323
group: ${{ github.workflow }}-${{ github.ref }}
2424
cancel-in-progress: true
2525

26+
# Ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
27+
permissions:
28+
contents: read
29+
2630
jobs:
2731
lintGitHubActionsWithActionLint:
2832
runs-on: ubuntu-latest
@@ -74,7 +78,8 @@ jobs:
7478
uses: actions-rust-lang/setup-rust-toolchain@v1
7579

7680
- name: Install zizmor
77-
run: cargo install zizmor
81+
# Install zizmor if it's not already installed via the Rust cache
82+
run: zizmor --help || cargo install zizmor
7883

7984
- name: Run zizmor on GitHub Actions
8085
run: zizmor .github/workflows/*

.github/workflows/lint-go.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ concurrency:
1818
group: ${{ github.workflow }}-${{ github.ref }}
1919
cancel-in-progress: true
2020

21+
# Ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
22+
permissions:
23+
contents: read
24+
2125
jobs:
2226

2327
lintGo:

.github/workflows/lint-markdown.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ concurrency:
1919
group: ${{ github.workflow }}-${{ github.ref }}
2020
cancel-in-progress: true
2121

22+
# Ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
23+
permissions:
24+
contents: read
25+
2226
jobs:
2327
lintMarkdown:
2428
runs-on: ubuntu-latest

.github/workflows/lint-yaml.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ concurrency:
2323
group: ${{ github.workflow }}-${{ github.ref }}
2424
cancel-in-progress: true
2525

26+
# Ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
27+
permissions:
28+
contents: read
29+
2630
jobs:
2731
lintYaml:
2832
runs-on: ubuntu-latest

.github/workflows/test-go.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ concurrency:
1818
group: ${{ github.workflow }}-${{ github.ref }}
1919
cancel-in-progress: true
2020

21+
# Ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
22+
permissions:
23+
contents: read
24+
2125
jobs:
2226

2327
testGo:

0 commit comments

Comments
 (0)