Skip to content

Commit 3dbf1c1

Browse files
committed
Run CodeQL on PRs
1 parent f164e63 commit 3dbf1c1

File tree

2 files changed

+75
-48
lines changed

2 files changed

+75
-48
lines changed

.github/workflows/codeql-daily.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

.github/workflows/codeql.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CodeQL
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- release/*
8+
pull_request:
9+
branches:
10+
- main
11+
- release/*
12+
schedule:
13+
- cron: "07 04 * * 4" # weekly at 04:07 UTC on Thursday
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
analyze:
20+
name: Analyze (${{ matrix.language }})
21+
permissions:
22+
contents: read
23+
actions: read # for github/codeql-action/init to get workflow details
24+
security-events: write # for github/codeql-action/analyze to upload SARIF results
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
include:
29+
- language: actions
30+
- language: java
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
34+
35+
- name: Set up Java 17
36+
if: matrix.language == 'java'
37+
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
38+
with:
39+
distribution: temurin
40+
java-version: 17
41+
42+
- name: Set up gradle
43+
if: matrix.language == 'java'
44+
uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
45+
46+
- name: Initialize CodeQL
47+
uses: github/codeql-action/init@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19
48+
with:
49+
languages: ${{ matrix.language }}
50+
# using "latest" helps to keep up with the latest Kotlin support
51+
# see https://github.com/github/codeql-action/issues/1555#issuecomment-1452228433
52+
tools: latest
53+
54+
- name: Assemble
55+
if: matrix.language == 'java'
56+
# --no-build-cache is required for codeql to analyze all modules
57+
# --no-daemon is required for codeql to observe the compilation
58+
# (see https://docs.github.com/en/code-security/codeql-cli/getting-started-with-the-codeql-cli/preparing-your-code-for-codeql-analysis#specifying-build-commands)
59+
run: ./gradlew assemble --no-build-cache --no-daemon
60+
61+
- name: Perform CodeQL analysis
62+
uses: github/codeql-action/analyze@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19
63+
with:
64+
category: "/language:${{matrix.language}}"
65+
66+
workflow-notification:
67+
permissions:
68+
contents: read
69+
issues: write
70+
needs:
71+
- analyze
72+
if: always()
73+
uses: ./.github/workflows/reusable-workflow-notification.yml
74+
with:
75+
success: ${{ needs.analyze.result == 'success' }}

0 commit comments

Comments
 (0)