Skip to content

Commit 5cc9c2c

Browse files
committed
ci: combine SARIF files for avoiding GitHub limits
GitHub only allows 20 SARIF runs in a single upload. However, our number of modules already exceeds this limit. Therefore, we combine the resulting detekt sarif files into a single file with only a single run, which circumvents this limit.
1 parent cdaa1da commit 5cc9c2c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.github/workflows/build.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,18 @@ jobs:
5656
token: ${{ secrets.GITHUB_TOKEN }}
5757
title: JVM coverage report
5858
update-comment: true
59+
# We need to combine the SARIF files because GitHub has a limit of 20 runs. Our number of modules + targets
60+
# exceeds this limit. Therefore, we combine the individual runs in the SARIF files.
61+
- uses: actions/setup-node@v4
62+
with:
63+
node-version: '20.x'
64+
- name: Combine SARIF files
65+
run: |
66+
npx @microsoft/sarif-multitool merge --merge-runs --output-file merged.sarif $(find . -iname '*.sarif*')
5967
- name: Upload SARIF file
6068
uses: github/codeql-action/upload-sarif@v3
6169
with:
62-
sarif_file: 'build/reports/detekt/'
70+
sarif_file: merged.sarif
6371
category: detekt
6472

6573
test-model-api-gen-gradle:

build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ subprojects {
170170

171171
reports {
172172
sarif.required.set(true)
173-
// This is required for the GitHub upload action to easily find all sarif files in a single directory.
174-
sarif.outputLocation.set(parentProject.layout.buildDirectory.file("reports/detekt/${project.name}.sarif"))
175173
html.required.set(true)
176174
}
177175
}

0 commit comments

Comments
 (0)