Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,35 @@

jobs:
test:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Tidy
run: go mod tidy && git diff --exit-code

- name: Install dependencies
run: go install github.com/vektra/mockery/[email protected]

- name: Generate
run: go generate ./... && git diff --exit-code

- name: Build
run: go build -o=/dev/null ./cmd/...

- name: Lint
uses: golangci/[email protected]
with:
args: --timeout 3m

- name: Run tests
run: go test -race -shuffle=on -v ./...
run: go test -race -shuffle=on -v ./...

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium test

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 23 days ago

To fix the problem, the workflow should explicitly set the minimum required permissions for the GITHUB_TOKEN used by the workflow. The recommended approach is to add a permissions: { contents: read } block, which grants the workflow read-only access to the repository contents—sufficient for fetching code and not for performing any write operations. Since the workflow only performs actions like checkout, setup, tidying, building, linting, and testing, and does not push changes or interact with pull requests/write APIs, contents: read is the minimum necessary. The permissions key can be placed at the top level of the workflow, so it applies to all jobs in the workflow. The block should be added after the name: or on: key on line 16 or 22.

Suggested changeset 1
.github/workflows/test.yaml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -14,6 +14,9 @@
 
 name: Run tests
 
+permissions:
+  contents: read
+
 on:
   pull_request: {}
   push:
EOF
@@ -14,6 +14,9 @@

name: Run tests

permissions:
contents: read

on:
pull_request: {}
push:
Copilot is powered by AI and may make mistakes. Always verify output.
Loading