Skip to content

Commit 90ba176

Browse files
authored
Merge pull request #16 from wgpsec/copilot/fix-secret-scan-workflow
Fix TruffleHog workflow failing on push events with "BASE and HEAD commits are the same"
2 parents 05d0179 + a226f0b commit 90ba176

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

.github/workflows/secret-scan.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,25 @@ jobs:
2020
with:
2121
fetch-depth: 0 # Fetch all history for better scanning
2222

23-
- name: TruffleHog Secret Scanning
23+
- name: TruffleHog Secret Scanning (Push/Workflow Dispatch)
24+
if: github.event_name != 'pull_request'
2425
uses: trufflesecurity/trufflehog@v3.82.13
2526
with:
2627
# Scan the entire repository for secrets
2728
path: ./
28-
base: ${{ github.event.repository.default_branch }}
29-
head: HEAD
29+
# Scan for both verified and unverified secrets
30+
# Focus on detecting: Access Keys, Secret Keys, Passwords, API Tokens
31+
# Note: --fail is added automatically by the action
32+
extra_args: --exclude-paths=.trufflehogignore --json
33+
34+
- name: TruffleHog Secret Scanning (Pull Request)
35+
if: github.event_name == 'pull_request'
36+
uses: trufflesecurity/trufflehog@v3.82.13
37+
with:
38+
# Scan the entire repository for secrets
39+
path: ./
40+
base: ${{ github.event.pull_request.base.sha }}
41+
head: ${{ github.event.pull_request.head.sha }}
3042
# Scan for both verified and unverified secrets
3143
# Focus on detecting: Access Keys, Secret Keys, Passwords, API Tokens
3244
# Note: --fail is added automatically by the action

0 commit comments

Comments
 (0)