Skip to content

Commit 0ee1f8a

Browse files
authored
Add CodeQL workflow (#1767)
1 parent adb7155 commit 0ee1f8a

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

.github/workflows/codeql.yml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ 'main', '1.0.x', '1.1.x', '1.2.x', '1.3.x', '1.4.x', '1.5.x', '2.0.x', '2.1.x', '2.2.x', '3.0.x', '3.1.x', '3.2.x', '4.0.x', '4.1.x', '4.2.x', '4.3.x', '4.4.x', '5.0.x', '5.1.x' ]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [ 'main' ]
9+
schedule:
10+
- cron: '59 19 * * 2'
11+
12+
jobs:
13+
analyze:
14+
name: Analyze
15+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
16+
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
17+
permissions:
18+
actions: read
19+
contents: read
20+
security-events: write
21+
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
language: [ 'java' ]
26+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
27+
# Use only 'java' to analyze code written in Java, Kotlin or both
28+
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
29+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v3
34+
35+
- if: matrix.language == 'java'
36+
name: Set up JDK 17
37+
uses: actions/setup-java@v3
38+
with:
39+
java-version: '17'
40+
distribution: 'adopt'
41+
42+
# Initializes the CodeQL tools for scanning.
43+
- name: Initialize CodeQL
44+
uses: github/codeql-action/init@v2
45+
with:
46+
languages: ${{ matrix.language }}
47+
# If you wish to specify custom queries, you can do so here or in a config file.
48+
# By default, queries listed here will override any specified in a config file.
49+
# Prefix the list here with "+" to use these queries and those in the config file.
50+
51+
# 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
52+
# queries: security-extended,security-and-quality
53+
54+
55+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
56+
# If this step fails, then you should remove it and run the build manually (see below)
57+
- name: Autobuild
58+
uses: github/codeql-action/autobuild@v2
59+
60+
# ℹ️ Command-line programs to run using the OS shell.
61+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
62+
63+
# If the Autobuild fails above, remove it and uncomment the following three lines.
64+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
65+
66+
# - run: |
67+
# echo "Run, Build Application using script"
68+
# ./location_of_script_within_repo/buildscript.sh
69+
70+
- name: Perform CodeQL Analysis
71+
uses: github/codeql-action/analyze@v2
72+
with:
73+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)