Skip to content

Commit cb81d5e

Browse files
committed
cleanup
1 parent fca5f5d commit cb81d5e

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

action.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,22 @@ description: >-
1010
inputs:
1111
github-token:
1212
description: "GitHub token for authentication."
13-
type: string
1413
required: false
1514
image-ref:
1615
description: "Specify the local Docker image to be scanned. This value needs to be set if the scan-type = image."
17-
type: string
1816
required: false
1917
matrix-id:
2018
description: "Specify the matrix indicator to be leveraged on notification steps."
21-
type: string
2219
required: false
2320
scan-type:
2421
description: >-
2522
"Specify the type of scan to be perforemed (e.g., 'fs' for filesystem scan, `image` for image scan)."
26-
type: string
2723
required: true
2824
slack-bot-token:
2925
description: "Slackbot token for sending notifications."
30-
type: string
26+
required: false
27+
slack-channel-id:
28+
description: "Slack channel ID for sending notifications."
3129
required: false
3230

3331
outputs:
@@ -91,7 +89,7 @@ runs:
9189

9290
- name: Upload Trivy Report as PR Comment and parse Critical vulnerabilities
9391
id: trivy_report_notification
94-
if: ${{ inputs.github-token }}
92+
if: ${{ inputs.github-token && github.event_name == 'pull_request' }}
9593
uses: actions/github-script@v7
9694
env:
9795
GITHUB_TOKEN: ${{ inputs.github-token }}
@@ -197,7 +195,7 @@ runs:
197195
198196
if (formattedContent.length > MAX_COMMENT_LENGTH) {
199197
fullCommentBody = `
200-
The Trivy ${scanTypeName} scan report${process.env.MATRIX_ID ? ` for ${process.env.MATRIX_ID}` : ''} too large to display here. Please view the detailed output from the job:
198+
The Trivy ${scanTypeName} scan report${process.env.MATRIX_ID ? ` for ${process.env.MATRIX_ID}` : ''} is too large to display here. Please view the detailed output from the job:
201199
202200
[View Trivy Report](https://github.com/${owner}/${repo}/actions/runs/${context.runId})
203201
@@ -226,7 +224,7 @@ runs:
226224
issue_number,
227225
body: fullCommentBody,
228226
});
229-
core.info('Created new Pr comment');
227+
core.info('Created new PR comment');
230228
}
231229
}
232230
@@ -236,7 +234,7 @@ runs:
236234
env:
237235
SLACK_BOT_TOKEN: ${{ inputs.slack-bot-token }}
238236
with:
239-
channel-id: 'C078TPMGC21'
237+
channel-id: ${{ inputs.slack-channel-id }}
240238
payload: |
241239
{
242240
"blocks": [
@@ -276,7 +274,7 @@ runs:
276274
env:
277275
SLACK_BOT_TOKEN: ${{ inputs.slack-bot-token }}
278276
with:
279-
channel-id: 'C078TPMGC21'
277+
channel-id: ${{ inputs.slack-channel-id }}
280278
payload: |
281279
{
282280
"blocks": [

0 commit comments

Comments
 (0)