Skip to content
Latchkey

trufflesecurity/trufflehog "BASE and HEAD are the same commit"

trufflehog scans the diff between BASE and HEAD. When both point at the same commit (often a shallow checkout or a push with no range), there is no diff to scan and the action errors or scans nothing.

What this error means

The trufflehog step fails or warns that BASE and HEAD are the same commit and scans no diff.

github-actions
Error: BASE and HEAD commits are the same. TruffleHog won't scan anything.
Please see https://github.com/trufflesecurity/trufflehog#scanning-a-github-pull-request

Common causes

Shallow checkout

fetch-depth: 1 leaves no prior commit to diff against, collapsing BASE and HEAD.

Missing base/head inputs

On non-PR events the action cannot infer a range, so BASE equals HEAD.

How to fix it

Fetch full history and set base/head

  1. Set fetch-depth: 0 on checkout so the full history is available.
  2. Set base and head inputs (or rely on PR context) so a real range exists.
  3. Re-run the scan.
.github/workflows/secrets-scan.yml
- uses: actions/checkout@v4
  with:
    fetch-depth: 0
- uses: trufflesecurity/trufflehog@main
  with:
    base: ${{ github.event.repository.default_branch }}
    head: HEAD

How to prevent it

  • Use fetch-depth: 0 for any action that diffs commit ranges.
  • Provide base/head explicitly outside pull_request contexts.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →