File tree Expand file tree Collapse file tree 1 file changed +21
-4
lines changed
Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,24 @@ jobs:
137137 merge-multiple : false
138138
139139 - name : Upload SARIF files to GitHub Security
140- uses : github/codeql-action/upload-sarif@v4
141- with :
142- sarif_file : " ."
143- category : " docker-security-scan"
140+ run : |
141+ # Upload each SARIF file with a unique category
142+ find . -name "*.sarif" -type f | while read -r sarif_file; do
143+ # Extract image name from directory path for category
144+ category=$(basename $(dirname "$sarif_file") | sed 's/^sarif-//' | sed 's/-[0-9]*$//')
145+ echo "Uploading $sarif_file with category: docker-$category"
146+
147+ # Use gh CLI to upload SARIF (simpler than action in loop)
148+ cat "$sarif_file" | gh api \
149+ --method POST \
150+ -H "Accept: application/vnd.github+json" \
151+ -H "X-GitHub-Api-Version: 2022-11-28" \
152+ /repos/${{ github.repository }}/code-scanning/sarifs \
153+ -f sarif=@- \
154+ -f ref="${{ github.ref }}" \
155+ -f commit_sha="${{ github.sha }}" \
156+ -f checkout_uri="${{ github.server_url }}/${{ github.repository }}" \
157+ -f category="docker-$category" || echo "Failed to upload $sarif_file"
158+ done
159+ env :
160+ GH_TOKEN : ${{ github.token }}
You can’t perform that action at this time.
0 commit comments