You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, CodeQL runs all languages defined in the array, even when a pull request does not touch a particular language. For example a single change to index.js triggers Python tests if that repo contains any Python at all.
Some of the checks take much longer than the others, so engineers are often sat waiting around for Python checks to pass when they didn't change any Python.
It would be great if this action was able to check the file extensions changed in a Pull Request, and set the matrix accordingly.
@CallMeGreg I'd like to take this on if that works for you?
@p5 Some engineering teams may prefer to maintain control over this aspect themselves. It might be worthwhile to consider adding an option where, if specific files are provided to the action, it returns the detected languages based on their extensions.
In the absence of any specified files, the action could default to its current behavior, returning all detected languages?
if specific files are provided to the action, it returns the detected languages based on their extensions.
Apologies for not quite following your suggestion here regarding the specific files being provided. Do you mean having a custom step before this which will query git for the changed files, feeding all of them into this action as an input?
I agree that we should try and keep the current usage available to consumers of the action, so I was thinking of an input such as filter-changed-file-types: true|false (defaulting to the current behaviour of false).
@LeShadow by all means, thanks for contributing! FWIW, I believe GitHub uses linguist to determine languages in repositories. Love the idea @p5 shared about an input parameter along the lines of only-scan-changed-file-types defaulting to false.
I would use something like this action: https://github.com/tj-actions/changed-files
(It can output changed files in a multitude of ways, like separated by a comma, or in json format)
And then feed the output of that action into this action where we can return languages based on the extensions found in the list of files.
However, if the argument is empty, we just return all detected languages.
Does that make sense?
PS: I think that if we add functionality to detect changed files to this action, instead of feeding it a list, that it would overcomplicate things.
Caveat here is this will break any rules/rulesets that require code scanning results before merge on PR. If you skip scanning those languages- the rule will never be satisfied. It waits for the expected categories to upload for any category it has sent uploaded against the base branch.
We have workarounds for this "republish/sarif-caching" but they are not OOTB :
Activity
LeShadow commentedon Oct 16, 2024
@CallMeGreg I'd like to take this on if that works for you?
@p5 Some engineering teams may prefer to maintain control over this aspect themselves. It might be worthwhile to consider adding an option where, if specific files are provided to the action, it returns the detected languages based on their extensions.
In the absence of any specified files, the action could default to its current behavior, returning all detected languages?
p5 commentedon Oct 17, 2024
Apologies for not quite following your suggestion here regarding the specific files being provided. Do you mean having a custom step before this which will query git for the changed files, feeding all of them into this action as an input?
I agree that we should try and keep the current usage available to consumers of the action, so I was thinking of an input such as
filter-changed-file-types: true|false(defaulting to the current behaviour of false).CallMeGreg commentedon Oct 17, 2024
@LeShadow by all means, thanks for contributing! FWIW, I believe GitHub uses linguist to determine languages in repositories. Love the idea @p5 shared about an input parameter along the lines of
only-scan-changed-file-typesdefaulting to false.cc @leftrightleft
LeShadow commentedon Oct 17, 2024
@CallMeGreg Thanks! I already started on something in the background!
@p5 Exactly!
I would use something like this action: https://github.com/tj-actions/changed-files
(It can output changed files in a multitude of ways, like separated by a comma, or in json format)
And then feed the output of that action into this action where we can return languages based on the extensions found in the list of files.
However, if the argument is empty, we just return all detected languages.
Does that make sense?
PS: I think that if we add functionality to detect changed files to this action, instead of feeding it a list, that it would overcomplicate things.
felickz commentedon Aug 5, 2026
Caveat here is this will break any rules/rulesets that require code scanning results before merge on PR. If you skip scanning those languages- the rule will never be satisfied. It waits for the expected categories to upload for any category it has sent uploaded against the base branch.
We have workarounds for this "republish/sarif-caching" but they are not OOTB :
https://github.com/advanced-security/monorepo-code-scanning-action#republish