Skip to content

Commit 5055cf5

Browse files
committed
ci: use gitleaks CLI for secret scan
1 parent 74312bc commit 5055cf5

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

.github/workflows/secrets.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,25 @@ jobs:
2020
- uses: actions/checkout@v4
2121
with:
2222
fetch-depth: 0
23-
- uses: gitleaks/gitleaks-action@v2
24-
env:
25-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26-
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
23+
- name: Install gitleaks
24+
run: |
25+
GITLEAKS_VERSION=8.30.1
26+
ARCHIVE="gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz"
27+
CHECKSUMS="gitleaks_${GITLEAKS_VERSION}_checksums.txt"
28+
BASE_URL="https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}"
29+
30+
curl -sSLO "${BASE_URL}/${ARCHIVE}"
31+
curl -sSLO "${BASE_URL}/${CHECKSUMS}"
32+
grep "${ARCHIVE}" "${CHECKSUMS}" | sha256sum -c -
33+
tar -xzf "${ARCHIVE}" gitleaks
34+
sudo mv gitleaks /usr/local/bin/gitleaks
35+
36+
- name: Run gitleaks on PR commits
37+
if: github.event_name == 'pull_request'
38+
run: |
39+
gitleaks git --log-opts="${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}" --verbose --redact
40+
41+
- name: Run gitleaks on repository history
42+
if: github.event_name != 'pull_request'
43+
run: |
44+
gitleaks git --verbose --redact

0 commit comments

Comments
 (0)