Skip to content

Commit be7735b

Browse files
authored
Merge pull request #12400 from swagger-api/CodeQl_Sarif_Filter-apply
Apply Sarif Filter to CodeQl configuration
2 parents 96b9a7d + 17c46b8 commit be7735b

File tree

1 file changed

+20
-36
lines changed

1 file changed

+20
-36
lines changed

Diff for: .github/workflows/codeql.yml

+20-36
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,8 @@ jobs:
3939
strategy:
4040
fail-fast: false
4141
matrix:
42-
include:
43-
- language: java-kotlin
44-
build-mode: none # This mode only analyzes Java. Set this to 'autobuild' or 'manual' to analyze Kotlin too.
45-
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
46-
# Use `c-cpp` to analyze code written in C, C++ or both
47-
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
48-
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
49-
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
50-
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
51-
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
52-
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
42+
language: [ 'java' ]
43+
5344
steps:
5445
- name: Checkout repository
5546
uses: actions/checkout@v4
@@ -59,34 +50,27 @@ jobs:
5950
uses: github/codeql-action/init@v3
6051
with:
6152
languages: ${{ matrix.language }}
62-
build-mode: ${{ matrix.build-mode }}
63-
config: |
64-
paths-ignore:
65-
- 'samples/'
66-
# If you wish to specify custom queries, you can do so here or in a config file.
67-
# By default, queries listed here will override any specified in a config file.
68-
# Prefix the list here with "+" to use these queries and those in the config file.
69-
70-
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
71-
# queries: security-extended,security-and-quality
7253

73-
# If the analyze step fails for one of the languages you are analyzing with
74-
# "We were unable to automatically build your code", modify the matrix above
75-
# to set the build mode to "manual" for that language. Then modify this step
76-
# to build your code.
77-
# ℹ️ Command-line programs to run using the OS shell.
78-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
79-
- if: matrix.build-mode == 'manual'
80-
shell: bash
81-
run: |
82-
echo 'If you are using a "manual" build mode for one or more of the' \
83-
'languages you are analyzing, replace this with the commands to build' \
84-
'your code, for example:'
85-
echo ' make bootstrap'
86-
echo ' make release'
87-
exit 1
54+
- name: Autobuild
55+
uses: github/codeql-action/autobuild@v3
8856

8957
- name: Perform CodeQL Analysis
9058
uses: github/codeql-action/analyze@v3
9159
with:
9260
category: "/language:${{matrix.language}}"
61+
output: sarif-results
62+
upload: failure-only
63+
64+
- name: filter-sarif
65+
uses: advanced-security/filter-sarif@v1
66+
with:
67+
patterns: |
68+
-**/samples/**
69+
input: sarif-results/java.sarif
70+
output: sarif-results/java.sarif
71+
72+
- name: Upload SARIF
73+
uses: github/codeql-action/upload-sarif@v3
74+
with:
75+
sarif_file: sarif-results/java.sarif
76+

0 commit comments

Comments
 (0)