Skip to content

Commit 2df95ce

Browse files
committed
ci: switch gitleaks-action to gitleaks CLI
The marketplace action calls /pulls/<n>/commits which fails on Dependabot PRs (read-only GITHUB_TOKEN, 403 'Resource not accessible by integration'). Running the CLI on the checked-out tree avoids the GitHub API entirely and works for push, normal PRs, and Dependabot PRs. SARIF output uploaded to the Security tab for triage.
1 parent a47717b commit 2df95ce

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,28 @@ jobs:
8989
- uses: actions/checkout@v4
9090
with:
9191
fetch-depth: 0
92-
- name: gitleaks
93-
uses: gitleaks/gitleaks-action@v2
94-
env:
95-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92+
- name: Install gitleaks
93+
run: |
94+
curl -fsSL -o /tmp/gitleaks.tar.gz \
95+
https://github.com/gitleaks/gitleaks/releases/download/v8.24.3/gitleaks_8.24.3_linux_x64.tar.gz
96+
tar -xzf /tmp/gitleaks.tar.gz -C /tmp gitleaks
97+
sudo mv /tmp/gitleaks /usr/local/bin/gitleaks
98+
gitleaks version
99+
- name: Scan repo (full history)
100+
run: |
101+
gitleaks detect \
102+
--source=. \
103+
--redact \
104+
--no-banner \
105+
--exit-code=1 \
106+
--report-format=sarif \
107+
--report-path=gitleaks.sarif
108+
- name: Upload SARIF (visible in Security tab)
109+
if: always()
110+
uses: github/codeql-action/upload-sarif@v3
111+
with:
112+
sarif_file: gitleaks.sarif
113+
continue-on-error: true
96114

97115
markdown-links:
98116
name: markdown-link-check (non-blocking)

0 commit comments

Comments
 (0)