Skip to content

Commit 4e831e1

Browse files
committed
CI: Update CodeQL to v4, conditional SARIF uploads, and enable buildx load for Trivy
1 parent b9331ca commit 4e831e1

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,14 @@ jobs:
7676
with:
7777
args: -fmt sarif -out gosec-results.sarif ./...
7878

79+
- name: Check for Gosec SARIF results
80+
id: check-gosec
81+
run: |
82+
if [ -f gosec-results.sarif ]; then echo "exists=true" >> $GITHUB_OUTPUT; else echo "exists=false" >> $GITHUB_OUTPUT; fi
83+
7984
- name: Upload Gosec results to GitHub Security
80-
uses: github/codeql-action/upload-sarif@v3
81-
if: always()
85+
uses: github/codeql-action/upload-sarif@v4
86+
if: ${{ always() && (steps.check-gosec.outputs.exists == 'true') }}
8287
with:
8388
sarif_file: gosec-results.sarif
8489

@@ -125,6 +130,7 @@ jobs:
125130
with:
126131
context: .
127132
push: false
133+
load: true
128134
tags: minipaas:${{ github.sha }}
129135
cache-from: type=gha
130136
cache-to: type=gha,mode=max
@@ -137,8 +143,13 @@ jobs:
137143
output: "trivy-results.sarif"
138144
severity: "CRITICAL,HIGH"
139145

146+
- name: Check for Trivy SARIF results
147+
id: check-trivy
148+
run: |
149+
if [ -f trivy-results.sarif ]; then echo "exists=true" >> $GITHUB_OUTPUT; else echo "exists=false" >> $GITHUB_OUTPUT; fi
150+
140151
- name: Upload Trivy scan results
141-
uses: github/codeql-action/upload-sarif@v3
142-
if: always()
152+
uses: github/codeql-action/upload-sarif@v4
153+
if: ${{ always() && (steps.check-trivy.outputs.exists == 'true') }}
143154
with:
144155
sarif_file: trivy-results.sarif

0 commit comments

Comments
 (0)