From 0899505e14558fbfafe56dbd9727a45c80b4db07 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 31 Oct 2025 14:50:38 +0100 Subject: [PATCH] Fix SARIF file handling in GitHub workflow Patch SARIF file for GitHub upload and update upload step. Signed-off-by: Niels Lohmann --- .github/workflows/msvc.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml index 400608cbd..f38ff6ae0 100644 --- a/.github/workflows/msvc.yml +++ b/.github/workflows/msvc.yml @@ -52,15 +52,15 @@ jobs: # Ruleset file that will determine what checks will be run ruleset: NativeRecommendedRules.ruleset - # Upload SARIF file to GitHub Code Scanning Alerts + - name: Patch SARIF for GitHub upload + shell: pwsh + run: | + $sarif = Get-Content "${{ steps.run-analysis.outputs.sarif }}" -Raw | ConvertFrom-Json + $i = 0 + foreach ($run in $sarif.runs) { $run.properties.category = "run-$i"; $i++ } + $sarif | ConvertTo-Json -Depth 100 | Out-File -Encoding utf8 "${{ env.build }}/results_fixed.sarif" + - name: Upload SARIF to GitHub uses: github/codeql-action/upload-sarif@v3 with: - sarif_file: ${{ steps.run-analysis.outputs.sarif }} - - # Upload SARIF file as an Artifact to download and view - # - name: Upload SARIF as an Artifact - # uses: actions/upload-artifact@v4 - # with: - # name: sarif-file - # path: ${{ steps.run-analysis.outputs.sarif }} + sarif_file: ${{ env.build }}/results_fixed.sarif