Skip to content

Commit bd0a4d1

Browse files
Revert "fix(trufflehog): scope merge_group scans to diff like pull_request"
This reverts commit 35d1495.
1 parent 35d1495 commit bd0a4d1

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

.github/workflows/reusable-trufflehog.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,10 @@ jobs:
4343
fetch-depth: 1
4444
persist-credentials: true
4545

46-
- name: Fetch base and head commits (pull_request)
46+
- name: Fetch base and head commits
4747
if: github.event_name == 'pull_request'
4848
run: git fetch --depth=1 origin ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}
4949

50-
- name: Fetch base and head commits (merge_group)
51-
if: github.event_name == 'merge_group'
52-
run: git fetch --depth=1 origin ${{ github.event.merge_group.base_sha }} ${{ github.event.merge_group.head_sha }}
53-
5450
- name: Remove persisted credentials
5551
run: git config --unset-all http.https://github.com/.extraheader
5652

@@ -101,15 +97,10 @@ jobs:
10197
set +e
10298
echo "[]" > results.json
10399
104-
if [[ "${{ github.event_name }}" == "pull_request" ]] || [[ "${{ github.event_name }}" == "merge_group" ]]; then
105-
# PR / merge queue: scan only paths that differ from base..head (not the entire checkout)
106-
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
107-
echo "Scanning changed files in PR..."
108-
git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} > changed-files.txt
109-
else
110-
echo "Scanning changed files in merge group..."
111-
git diff --name-only ${{ github.event.merge_group.base_sha }} ${{ github.event.merge_group.head_sha }} > changed-files.txt
112-
fi
100+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
101+
# PR: Scan only changed files (using two-dot diff with explicit base SHA)
102+
echo "Scanning changed files in PR..."
103+
git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} > changed-files.txt
113104
114105
if [[ -s changed-files.txt ]]; then
115106
while IFS= read -r file; do
@@ -133,7 +124,7 @@ jobs:
133124
echo "No files changed"
134125
fi
135126
else
136-
# push to main (and any other events): full filesystem scan
127+
# Push to main: Scan current filesystem
137128
echo "Scanning current filesystem..."
138129
trufflehog filesystem . --exclude-paths /tmp/trufflehog-exclude.txt --concurrency 16 --json --no-update --results=verified,unverified > results.ndjson || true
139130
fi

0 commit comments

Comments
 (0)