Skip to content

Commit d88b019

Browse files
committed
Output Trivy scan results as table for non-main branches
1 parent 8b6af25 commit d88b019

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.github/workflows/image-scan.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
tags: buildcage:scan
3838

3939
- name: Scan image with Trivy
40-
id: trivy-scan
40+
if: github.ref == 'refs/heads/main'
4141
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0
4242
with:
4343
image-ref: ${{ github.event_name == 'schedule' && format('ghcr.io/{0}:latest', github.repository) || 'buildcage:scan' }}
@@ -49,6 +49,18 @@ jobs:
4949
severity: CRITICAL,HIGH
5050

5151
- name: Upload Trivy scan results to GitHub Security
52+
if: github.ref == 'refs/heads/main'
5253
uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
5354
with:
5455
sarif_file: trivy-results.sarif
56+
57+
- name: Scan image with Trivy
58+
if: github.ref != 'refs/heads/main'
59+
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0
60+
with:
61+
image-ref: buildcage:scan
62+
ignore-unfixed: true
63+
trivyignores: .trivyignore
64+
scanners: vuln
65+
format: table
66+
severity: CRITICAL,HIGH

0 commit comments

Comments
 (0)