Skip to content

Commit 9579497

Browse files
author
Umutcan ÖNER
committed
fix: update TruffleHog configuration to handle different workflow triggers
- Fix "BASE and HEAD commits are the same" error when running on main branch - Configure dynamic base/head selection based on workflow trigger type: - Pull requests: Compare PR head against PR base - Push events: Compare new commits against previous state - Scheduled runs: Scan entire history
1 parent 9b9fb5e commit 9579497

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

.github/workflows/security.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ jobs:
128128
uses: trufflesecurity/trufflehog@v3.63.7
129129
with:
130130
path: ./ # Scan entire repository
131-
base: ${{ github.event.repository.default_branch }} # Compare against default branch
132-
head: HEAD # Current commit
131+
base: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || (github.event_name == 'push' && github.event.before || '') }}
132+
head: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || (github.event_name == 'push' && github.event.after || 'HEAD') }}
133133
extra_args: --only-verified # Only report verified secrets
134134

135135

0 commit comments

Comments
 (0)