Skip to content

Commit dee20c8

Browse files
mschmickingclaude
andcommitted
ci: grant gitleaks the pull-requests scope it needs
The job failed before scanning anything: listing a pull request's commits needs pull-requests: read, and only contents: read was granted. PR comments are also disabled. Posting one needs pull-requests: write, and Dependabot pull requests run with a read-only token, so leaving comments on would have made every dependency PR fail for a reason unrelated to secrets. Findings still fail the check and appear in the job log. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 9b4ee66 commit dee20c8

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

.github/workflows/secret-scan.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414

1515
permissions:
1616
contents: read
17+
# gitleaks lists the pull request's commits to scan only what the PR adds; without
18+
# this the API call 403s and the job fails before scanning anything.
19+
pull-requests: read
1720

1821
jobs:
1922
gitleaks:
@@ -28,5 +31,11 @@ jobs:
2831
- uses: gitleaks/gitleaks-action@v2
2932
env:
3033
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
# Findings belong in the job log and the failed check, not in PR comments:
35+
# writing a comment needs pull-requests: write, and a Dependabot PR gets a
36+
# read-only token, so leaving this on makes those runs fail spuriously.
37+
GITLEAKS_ENABLE_COMMENTS: false
38+
# Do not phone home with usage data.
39+
GITLEAKS_ENABLE_UPLOAD_ARTIFACT: false
3140
# GITLEAKS_LICENSE is only required for organisation accounts; personal
3241
# repositories run without it.

0 commit comments

Comments
 (0)