@@ -77,18 +77,18 @@ jobs:
7777
7878 - name : TruffleHog Scan
7979 id : trufflehog
80- if : github.event_name != 'workflow_dispatch'
8180 uses : trufflesecurity/trufflehog@main
8281 continue-on-error : true
8382 with :
8483 base : ${{ github.event.pull_request.base.sha }}
8584 head : ${{ github.event.pull_request.head.sha }}
86- extra_args : --fail ${{ steps.config.outputs.exclude_args }}
85+ extra_args : --json ${{ steps.config.outputs.exclude_args }}
8786
8887 - name : Process scan results
8988 id : process
9089 if : github.event_name != 'workflow_dispatch'
9190 run : |
91+ # Check if TruffleHog found any secrets
9292 if [ "${{ steps.trufflehog.outcome }}" == "failure" ]; then
9393 echo "has_secrets=true" >> $GITHUB_OUTPUT
9494 echo "status=failure" >> $GITHUB_OUTPUT
@@ -105,28 +105,27 @@ jobs:
105105 with :
106106 script : |
107107 const commentMarker = '<!-- TRUFFLEHOG-SCAN-COMMENT -->';
108-
109108 const body = `${commentMarker}
110- # # :rotating_light: Secret Scanning Alert
109+ ## :rotating_light: Secret Scanning Alert
111110
112- **TruffleHog detected potential secrets in this pull request.**
111+ **TruffleHog detected potential secrets in this pull request.**
113112
114- # ## What to do:
115- 1. **Remove the exposed secret ** from your code
116- 2. **Rotate the credential immediately ** - assume it's compromised
117- 3. **Push the fix ** to this branch
118- 4. The scan will re-run automatically
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
119118
120- # ## Finding Details
121- Check the [workflow run logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for :
122- - File paths containing secrets
123- - Line numbers
124- - Secret types (API key, password, token, etc.)
125- - Verification status (verified = confirmed active)
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)
126125
127- ---
128- *This scan only checks files modified in this PR. Secrets are classified as **verified** (confirmed active) or **unverified** (potential match).*
129- ` ;
126+ ---
127+ *This scan only checks files modified in this PR. Secrets are classified as **verified** (confirmed active) or **unverified** (potential match).*
128+ `;
130129
131130 // Find existing comment
132131 const { data: comments } = await github.rest.issues.listComments({
@@ -173,4 +172,4 @@ Check the [workflow run logs](${{ github.server_url }}/${{ github.repository }}/
173172 if : steps.process.outputs.has_secrets == 'true'
174173 run : |
175174 echo "::error::Secrets detected in PR. Review the logs and PR comment for details."
176- exit 1
175+ exit 1
0 commit comments