Add path-filtered CodeQL workflow for content-specific analysis#1444
Merged
Conversation
Create .github/workflows/codeql.yml that uses dorny/paths-filter to detect which language directories changed, then only runs CodeQL analysis for those languages. This replaces the default setup which analyzed all languages on every PR regardless of changed files. On push to main and scheduled runs, all languages are analyzed. On PRs, only languages with changed files are analyzed. Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Consider tuning Code QL checks for Java files
Add path-filtered CodeQL workflow for content-specific analysis
May 26, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces an “advanced” CodeQL workflow that conditionally runs per-language analysis on pull requests based on which parts of the repo changed, while still running full multi-language scans on main pushes and on a weekly schedule.
Changes:
- Adds
.github/workflows/codeql.ymlusingdorny/paths-filterto detect which language directories changed on PRs. - Runs CodeQL as a matrix job with per-language gates so unaffected languages skip work on PRs.
- Configures push-to-
mainand scheduled runs to analyze languages unconditionally for full coverage.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/codeql.yml |
Adds path-filtered, matrix-based CodeQL scanning intended to reduce PR-time analysis work while retaining full scans on push/schedule. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 10
Comment on lines
+40
to
+46
| python: | ||
| - 'python/**' | ||
| go: | ||
| - 'go/**' | ||
| csharp: | ||
| - 'dotnet/**' | ||
| actions: |
Comment on lines
+68
to
+75
| - language: python | ||
| gate: python | ||
| - language: go | ||
| gate: go | ||
| - language: csharp | ||
| gate: csharp | ||
| - language: actions | ||
| gate: actions |
Comment on lines
+37
to
+40
| js: | ||
| - 'nodejs/**' | ||
| - 'scripts/**' | ||
| python: |
Comment on lines
+16
to
+18
| changes: | ||
| name: Detect changed paths | ||
| runs-on: ubuntu-latest |
Comment on lines
+23
to
+28
| java: ${{ steps.filter.outputs.java }} | ||
| js: ${{ steps.filter.outputs.js }} | ||
| python: ${{ steps.filter.outputs.python }} | ||
| go: ${{ steps.filter.outputs.go }} | ||
| csharp: ${{ steps.filter.outputs.csharp }} | ||
| actions: ${{ steps.filter.outputs.actions }} |
Comment on lines
+40
to
+46
| python: | ||
| - 'python/**' | ||
| go: | ||
| - 'go/**' | ||
| csharp: | ||
| - 'dotnet/**' | ||
| actions: |
Comment on lines
+68
to
+75
| - language: python | ||
| gate: python | ||
| - language: go | ||
| gate: go | ||
| - language: csharp | ||
| gate: csharp | ||
| - language: actions | ||
| gate: actions |
Comment on lines
+37
to
+40
| js: | ||
| - 'nodejs/**' | ||
| - 'scripts/**' | ||
| python: |
Comment on lines
+16
to
+18
| changes: | ||
| name: Detect changed paths | ||
| runs-on: ubuntu-latest |
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CodeQL default setup runs all 7 language analyzers on every PR regardless of which files changed. A Java-only PR shouldn't wait for Python, Go, C#, JS, and Actions scans.
Adds
.github/workflows/codeql.yml(advanced setup) withdorny/paths-filterto gate each language's analysis on whether its directory actually has changes:java/**→java-kotlin,nodejs/**/scripts/**→javascript-typescript, etc.)mainand weekly scheduled runsRequires admin action: A repo admin must switch CodeQL from "Default" to "Advanced" setup in Settings → Code security → Code scanning. Branch protection required checks may need updating if check names change.