File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,43 +102,6 @@ jobs:
102102 - name : Lint
103103 run : npm run lint
104104
105- trivy-scan :
106- name : Security - Trivy Scan
107- runs-on : ubuntu-latest
108- steps :
109- - name : Checkout
110- uses : actions/checkout@v4
111-
112- - name : Setup Node.js
113- uses : actions/setup-node@v4
114- with :
115- node-version : ${{ inputs.node-version }}
116- cache : ' npm'
117-
118- - name : Cache dependencies
119- uses : actions/cache@v4
120- id : node-modules-cache
121- with :
122- path : ' **/node_modules'
123- key : ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
124- restore-keys : |
125- ${{ runner.os }}-modules-
126-
127- - name : Install dependencies
128- if : steps.node-modules-cache.outputs.cache-hit != 'true'
129- run : npm ci
130-
131- - name : Run Trivy vulnerability scanner
132- uses : aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0
133- with :
134- scan-type : ' fs'
135- scan-ref : ' .'
136- format : ' table'
137- severity : ' CRITICAL,HIGH'
138- exit-code : ' 1'
139- ignore-unfixed : true
140- scanners : ' vuln' # Only scan for vulnerabilities, not secrets
141-
142105 fossa-scan :
143106 name : License - Fossa Scan
144107 runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 1818 secrets :
1919 fossa-api-key : ${{ secrets.FOSSA_API_KEY }}
2020
21+ check-dependency-changes :
22+ name : Check for dependency changes
23+ runs-on : ubuntu-latest
24+ outputs :
25+ deps-changed : ${{ steps.filter.outputs.deps }}
26+ steps :
27+ - name : Checkout
28+ uses : actions/checkout@v4
29+
30+ - name : Check for dependency file changes
31+ id : filter
32+ uses : dorny/paths-filter@v3
33+ with :
34+ filters : |
35+ deps:
36+ - 'package.json'
37+ - 'package-lock.json'
38+ - 'Dockerfile'
39+
40+ trivy-scan :
41+ name : Security - Trivy Scan
42+ needs : check-dependency-changes
43+ if : needs.check-dependency-changes.outputs.deps-changed == 'true'
44+ runs-on : ubuntu-latest
45+ steps :
46+ - name : Checkout
47+ uses : actions/checkout@v4
48+
49+ - name : Setup Node.js
50+ uses : actions/setup-node@v4
51+ with :
52+ node-version : ' 22.1.0'
53+ cache : ' npm'
54+
55+ - name : Install dependencies
56+ run : npm ci
57+
58+ - name : Run Trivy vulnerability scanner
59+ uses : aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0
60+ with :
61+ scan-type : ' fs'
62+ scan-ref : ' .'
63+ format : ' table'
64+ severity : ' CRITICAL,HIGH'
65+ exit-code : ' 1'
66+ ignore-unfixed : true
67+ scanners : ' vuln'
68+
2169 build-docker-image :
2270 name : Build the Docker Image
2371 runs-on : ubuntu-latest
Original file line number Diff line number Diff line change @@ -128,9 +128,39 @@ jobs:
128128 VERSION : ${{ needs.get-context.outputs.new-version }}
129129 RELEASE_NOTES : ${{ steps.generate-notes.outputs.notes }}
130130
131+ trivy-scan :
132+ name : Security - Trivy Scan
133+ needs : [get-context]
134+ if : ${{ needs.get-context.outputs.version-changed == 'true' }}
135+ runs-on : ubuntu-latest
136+ steps :
137+ - name : Checkout
138+ uses : actions/checkout@v4
139+ with :
140+ ref : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.commit_sha || github.sha }}
141+
142+ - name : Setup Node.js
143+ uses : actions/setup-node@v4
144+ with :
145+ node-version : ' 22'
146+
147+ - name : Install dependencies
148+ run : npm ci
149+
150+ - name : Run Trivy vulnerability scanner
151+ uses : aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0
152+ with :
153+ scan-type : ' fs'
154+ scan-ref : ' .'
155+ format : ' table'
156+ severity : ' CRITICAL,HIGH'
157+ exit-code : ' 1'
158+ ignore-unfixed : true
159+ scanners : ' vuln'
160+
131161 build-and-push :
132162 name : Build and push image to GHCR
133- needs : [get-context, create-release]
163+ needs : [get-context, create-release, trivy-scan ]
134164 if : ${{ needs.get-context.outputs.version-changed == 'true' }}
135165 runs-on : ubuntu-latest
136166 steps :
You can’t perform that action at this time.
0 commit comments