@@ -60,15 +60,16 @@ jobs:
6060 - name : Setup exclude config
6161 id : config
6262 run : |
63- if [ -n "${{ vars.TRUFFLEHOG_EXCLUDES }}" ]; then
64- echo "Using repo/org-level TRUFFLEHOG_EXCLUDES variable"
65- # Support both comma-separated and newline-separated patterns
66- echo "${{ vars.TRUFFLEHOG_EXCLUDES }}" | tr ',' '\n' | sed '/^$/d' > .trufflehog-ignore
67- else
68- echo "Using default exclusions from central workflow"
69- cat << 'EOF' > .trufflehog-ignore
63+ # Always include default exclusions first
64+ echo "Adding default exclusions..."
65+ cat << 'EOF' > .trufflehog-ignore
7066 ${{ env.DEFAULT_EXCLUDES }}
7167 EOF
68+
69+ # Append user-defined exclusions if set (additive, not replacement)
70+ if [ -n "${{ vars.TRUFFLEHOG_EXCLUDES }}" ]; then
71+ echo "Adding repo/org-level TRUFFLEHOG_EXCLUDES patterns..."
72+ echo "${{ vars.TRUFFLEHOG_EXCLUDES }}" | tr ',' '\n' | sed '/^$/d' >> .trufflehog-ignore
7273 fi
7374
7475 echo "Exclusion patterns:"
@@ -105,27 +106,37 @@ jobs:
105106 with :
106107 script : |
107108 const commentMarker = '<!-- TRUFFLEHOG-SCAN-COMMENT -->';
109+ const commitSha = '${{ github.event.pull_request.head.sha }}';
110+ const shortSha = commitSha.substring(0, 7);
111+ const scanTime = new Date().toISOString().replace('T', ' ').substring(0, 19) + ' UTC';
112+
108113 const body = `${commentMarker}
109- ## :rotating_light: Secret Scanning Alert
110-
111- **TruffleHog detected potential secrets in this pull request.**
112-
113- ### What to do:
114- 1. **Review the workflow logs** for detailed findings (file, line number, secret type)
115- 2. **Remove the exposed secret** from your code
116- 3. **Rotate the credential immediately** - assume it's compromised
117- 4. **Push the fix** to this branch
118-
119- ### Finding Details
120- Check the [workflow run logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for:
121- - File paths containing secrets
122- - Line numbers
123- - Secret types (API key, password, token, etc.)
124- - Verification status (verified = confirmed active)
125-
126- ---
127- *This scan only checks files modified in this PR. Secrets are classified as **verified** (confirmed active) or **unverified** (potential match).*
128- `;
114+ # # :rotating_light: Secret Scanning Alert
115+
116+ **TruffleHog detected potential secrets in this pull request.**
117+
118+ | Scan Details | |
119+ |--------------|---|
120+ | **Commit** | [\`${shortSha}\`](${{ github.server_url }}/${{ github.repository }}/commit/${commitSha}) |
121+ | **Scanned At** | ${scanTime} |
122+ | **Workflow Run** | [View Logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) |
123+
124+ # ## What to do:
125+ 1. **Remove the exposed secret** from your code
126+ 2. **Rotate the credential immediately** - assume it's compromised
127+ 3. **Push the fix** to this branch
128+ 4. The scan will re-run automatically
129+
130+ # ## Finding Details
131+ Check the [workflow run logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for :
132+ - File paths containing secrets
133+ - Line numbers
134+ - Secret types (API key, password, token, etc.)
135+ - Verification status (verified = confirmed active)
136+
137+ ---
138+ *Only files modified in this PR were scanned. Secrets are classified as **verified** (confirmed active) or **unverified** (potential match).*
139+ ` ;
129140
130141 // Find existing comment
131142 const { data: comments } = await github.rest.issues.listComments({
0 commit comments