Skip to content

Commit

Permalink
add script …
Browse files Browse the repository at this point in the history
  • Loading branch information
julienp committed Dec 17, 2024
1 parent 5ad3090 commit 0cc8a46
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/scripts/filter-sarif.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/python
# GitHub Code Scanning does not allow more than 20 runs per file. We filter out
# empty runs to avoid this limit. Note that the file needs to include at least
# one run.

import json

with open("snyk.sarif") as f:
sarif = json.load(f)

# Remove runs with no results
runs = [run for run in sarif["runs"] if len(run["results"]) > 0]

# Keep at least one run
runs = runs if len(runs) > 0 else [sarif["runs"][0]]

sarif["runs"] = runs

with open("out.sarif", "w") as out:
json.dump(sarif, out, indent=2)

0 comments on commit 0cc8a46

Please sign in to comment.