Fixes #1443: per-language CodeQL targeting#1510
Merged
Merged
Conversation
- The `changes` job now outputs a `matrix` JSON instead of per-language booleans
- `paths-filter` only runs on `pull_request` (on `push`/`schedule`, all languages are included)
- The `analyze` job uses `matrix: ${{ fromJson(needs.changes.outputs.matrix) }}` — only jobs for changed languages are created
- `if: ${{ fromJson(needs.changes.outputs.matrix).include[0] != null }}` prevents the job from running when no languages changed
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the CodeQL workflow to build a dynamic analysis matrix so pull requests only create CodeQL jobs for languages affected by changed paths, while push and scheduled runs still analyze all configured languages.
Changes:
- Replaces per-language
changesoutputs with a single JSON matrix output. - Runs
paths-filteronly for pull requests. - Uses the generated matrix directly in the CodeQL
analyzejob and skips it when no language entries are present.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/codeql.yml |
Adds dynamic CodeQL matrix construction and removes per-step language gate conditions. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
Code scanning branch protection expects results for every category previously uploaded on main. When the dynamic matrix excludes a language (no paths changed), the missing category blocks PR merge. Add a skip-analysis job that uploads an empty SARIF file for each language not included in the analysis matrix, so all 7 categories always have results.
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.
changesjob now outputs amatrixJSON instead of per-language booleanspaths-filteronly runs onpull_request(onpush/schedule, all languages are included)analyzejob usesmatrix: ${{ fromJson(needs.changes.outputs.matrix) }}— only jobs for changed languages are createdif: ${{ fromJson(needs.changes.outputs.matrix).include[0] != null }}prevents the job from running when no languages changed