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
38 changes: 38 additions & 0 deletions .github/workflows/gitleaks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Free: the MIT gitleaks CLI, not the separately licensed Action wrapper.
# PR scans block merge; main-push scans only warn (history is already published).
name: gitleaks
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
jobs:
gitleaks:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Install checksum-pinned gitleaks CLI 8.30.1
id: install
run: |
set -euo pipefail
cd "$RUNNER_TEMP"
curl -fsSL --max-time 60 -o gl.tar.gz \
https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_x64.tar.gz
echo '551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb gl.tar.gz' | sha256sum --check --strict
tar -xzf gl.tar.gz gitleaks
test "$(./gitleaks version)" = '8.30.1'
- name: Scan only this event's commits
id: scan
continue-on-error: ${{ github.event_name == 'push' }}
env:
RANGE: ${{ github.event_name == 'pull_request' && format('{0}..{1}', github.event.pull_request.base.sha, github.event.pull_request.head.sha) || format('{0}..{1}', github.event.before, github.event.after) }}
run: |
"$RUNNER_TEMP/gitleaks" git --no-banner --redact --exit-code 1 --log-opts="$RANGE" .
- name: Alert on a main-push finding
if: always() && github.event_name == 'push' && steps.scan.outcome == 'failure'
run: echo '::warning::gitleaks found candidates on main; operator review required.'
Loading