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-requestCommon 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
- Set fetch-depth: 0 on checkout so the full history is available.
- Set base and head inputs (or rely on PR context) so a real range exists.
- 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: HEADHow to prevent it
- Use fetch-depth: 0 for any action that diffs commit ranges.
- Provide base/head explicitly outside pull_request contexts.
Related guides
actions/dependency-review-action "only runs on pull_request events"Fix actions/dependency-review-action failing because it was triggered on a non-pull_request event.
github/super-linter "fatal: ref does not exist" (default branch not fetched)Fix github/super-linter failing to diff because the default branch was not fetched with full history.
GitHub Actions tj-actions/changed-files "fatal: ambiguous argument"Fix tj-actions/changed-files "fatal: ambiguous argument" - a shallow checkout lacks the history needed to dif…