-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (46 loc) · 1.35 KB
/
pr-trivy-scan.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Trivy
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
pull-requests: write
jobs:
trivy_scan:
runs-on: ubuntu-latest
name: Scan
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Trivy
uses: aquasecurity/[email protected]
env:
TRIVY_LIGHT: "true"
with:
scan-type: "fs"
scan-ref: "."
ignore-unfixed: true
format: "json"
output: "trivy-report.json"
severity: "CRITICAL,HIGH,MEDIUM,LOW"
exit-code: 1
- name: Build Trivy PR comment
if: always()
run: |
echo "## Trivy report summary" > trivy-comment.md
echo "<details>" >> trivy-comment.md
echo "<summary>show details</summary>" >> trivy-comment.md
echo "" >> trivy-comment.md
echo "\`\`\`json" >> trivy-comment.md
cat trivy-report.json >> trivy-comment.md
echo "\`\`\`" >> trivy-comment.md
echo "</details>" >> trivy-comment.md
cat trivy-comment.md >> $GITHUB_STEP_SUMMARY
- uses: mshick/add-pr-comment@v2
name: Add PR comment
if: always()
with:
message-id: trivy-report
refresh-message-position: true
message-path: |
trivy-comment.md