Draft
Add opt-in changed-files input to narrow CodeQL language matrix to touched languages#29
changed-files input to narrow CodeQL language matrix to touched languages#29Conversation
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
…iew/codeql_checker Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
…iles Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update CodeQL to set matrix based on changed file types
Add opt-in Aug 5, 2026
changed-files input to narrow CodeQL language matrix to touched languages
There was a problem hiding this comment.
Review details
Suppressed comments (2)
main.py:128
- The
actionslanguage filter currently checks for/.github/workflows/as a substring anywhere in the path. This will incorrectly treat files likefoo/.github/workflows/ci.ymlas GitHub Actions workflows, even though workflows must live at the repo root under.github/workflows/. Use a strict path-prefix check after normalization.
if language == "actions" and "/.github/workflows/" not in "/" + file_path:
continue
README.md:163
- The README states
changed-filesaccepts space-separated paths, but whitespace-delimited formats cannot unambiguously represent filenames that contain spaces (whichgit diff --name-onlycan output). Consider documenting this limitation and recommending the JSON array form when paths may contain spaces.
By default, the matrix includes every CodeQL-supported language detected in the repository, even if a given pull request doesn't touch any files in that language. To scan only the languages actually touched by a pull request, pass the list of changed files to the `changed-files` input. It accepts a comma, space, or newline separated list of file paths, or a JSON array (the output formats used by most "changed files" actions).
- Files reviewed: 5/5 changed files
- Comments generated: 0 new
- Review effort level: Lite
Contributor
|
@copilot add a ci.yml to run the tests on push and pr. |
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Contributor
Author
Added |
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 currently scans every language detected in the repo on every PR, even when the diff only touches one of them (e.g. an
index.jschange still triggers a full Python scan). This wastes CI time on slower language scans that have nothing to review.Changes
changed-filesinput (action.yml→entrypoint.sh→main.py): optional, defaults to unset so existing "scan everything" behavior is unchanged unless explicitly opted into.main.py):parse_changed_files()accepts a JSON array or a comma/newline/space-separated list (compatible withgit diff --name-onlyortj-actions/changed-filesoutput).filter_by_changed_files()maps changed file extensions to CodeQL language slugs and narrows the matrix to only those languages, applied afterexclude_languages()so excluded languages can't be reintroduced.javascriptincludes TypeScript files andjavaincludes Kotlin files whenstandard-language-namesis off, mirroring howbuild_languages_list()already folds those languages together.actionsonly matches files under.github/workflows/.monorepo-code-scanning-action'srepublish-sarifstep to keep required checks green for skipped languages; that action'sgithub-script-based, project-config-driven design means it can't be invoked directly from within this Docker action, so it's documented as a complementary workflow step rather than integrated in code.Example