Skip to content

Commit 748c520

Browse files
committed
ci: migrate CodeQL from default to advanced setup
The default setup only analysed a pull request when it touched files relevant to the configured languages. A PR changing only docs or a dependency manifest produced no analysis, while master still carried one per language, so the code_scanning branch rule could not diff the two sides and reported 'configurations not found'. Add a codeql.yml with no path filter so both configurations exist on every PR, keeping the /language:actions and /language:rust categories recorded on master.
1 parent 83e4dda commit 748c520

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# CodeQL advanced setup.
2+
#
3+
# Replaces the repository's CodeQL *default* setup, which only analyses a pull
4+
# request when it touches files relevant to the configured languages. A PR that
5+
# changes only docs or dependency manifests produced no analysis at all, while
6+
# `master` still carried one per language — so the `code_scanning` branch rule
7+
# could not diff the two sides and reported "configurations not found".
8+
#
9+
# Running here, with no path filter, guarantees both configurations exist on
10+
# every pull request. The categories below must keep matching the ones recorded
11+
# on `master` (`/language:actions`, `/language:rust`) for that diff to work.
12+
name: CodeQL
13+
14+
on:
15+
push:
16+
branches: [ "master" ]
17+
pull_request:
18+
branches: [ "master" ]
19+
schedule:
20+
# Weekly, to catch newly published queries against unchanged code.
21+
- cron: '27 4 * * 1'
22+
workflow_dispatch:
23+
24+
permissions:
25+
contents: read
26+
27+
jobs:
28+
analyze:
29+
name: Analyze (${{ matrix.language }})
30+
runs-on: ubuntu-latest
31+
permissions:
32+
contents: read
33+
security-events: write # upload the SARIF results
34+
actions: read
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
# Keep in sync with the languages the previous default setup covered.
39+
language: [ actions, rust ]
40+
41+
steps:
42+
- uses: actions/checkout@v7
43+
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v4
46+
with:
47+
languages: ${{ matrix.language }}
48+
# Neither language needs a compiled build for CodeQL to extract it.
49+
build-mode: none
50+
queries: security-extended
51+
52+
- name: Perform CodeQL analysis
53+
uses: github/codeql-action/analyze@v4
54+
with:
55+
category: "/language:${{ matrix.language }}"

0 commit comments

Comments
 (0)