Skip to content

Commit 5d6d470

Browse files
feat(docker-build): add security report option and upload step (#37)
1 parent 46f5c4f commit 5d6d470

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

.github/workflows/docker-build.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ on:
1919
description: 'Enable Security Scan'
2020
default: true
2121
type: boolean
22+
security-report:
23+
description: 'Enable Security Report'
24+
default: 'sarif'
25+
type: string
2226
hadolint:
2327
description: 'Enable Hadolint'
2428
default: true
@@ -100,7 +104,7 @@ jobs:
100104

101105
- name: Update Pull Request with Security Scan Results
102106
uses: actions/github-script@v7
103-
if: github.event_name == 'pull_request' && inputs.security-scan
107+
if: github.event_name == 'pull_request' && inputs.security-scan && inputs.security-report == 'comment'
104108
with:
105109
script: |
106110
const fs = require('fs');
@@ -123,6 +127,12 @@ jobs:
123127
body: output
124128
});
125129
130+
- name: Upload Trivy scan results to GitHub Security tab
131+
if: github.event_name == 'pull_request' && inputs.security-scan && inputs.security-report == 'sarif'
132+
uses: github/codeql-action/upload-sarif@v3
133+
with:
134+
sarif_file: 'trivy-results.sarif'
135+
126136
- name: Update Pull Request with Hadolint Results
127137
uses: actions/github-script@v7
128138
if: github.event_name == 'pull_request' && inputs.hadolint

0 commit comments

Comments
 (0)