Skip to content

Commit

Permalink
ci: reduce permissions for GitHub Actions (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashishb authored Dec 29, 2024
1 parent c8bf33b commit 97fda62
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/check-goreleaser-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# Ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
permissions:
contents: read

jobs:

checkGoReleaserConfig:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/format-go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# Ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
permissions:
contents: read

jobs:

validateCodeFormatGo:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/lint-github-actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# Ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
permissions:
contents: read

jobs:
lintGitHubActionsWithActionLint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -74,7 +78,8 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Install zizmor
run: cargo install zizmor
# Install zizmor if it's not already installed via the Rust cache
run: zizmor --help || cargo install zizmor

- name: Run zizmor on GitHub Actions
run: zizmor .github/workflows/*
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/lint-go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# Ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
permissions:
contents: read

jobs:

lintGo:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/lint-markdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# Ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
permissions:
contents: read

jobs:
lintMarkdown:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/lint-yaml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# Ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
permissions:
contents: read

jobs:
lintYaml:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test-go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# Ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
permissions:
contents: read

jobs:

testGo:
Expand Down

0 comments on commit 97fda62

Please sign in to comment.