Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds automatic detection of GitHub Actions workflows to the CodeQL Action's language detection system. Since GitHub's Linguist API doesn't classify Actions workflows as a language, this enhancement enables the CodeQL Action to detect them by checking for a non-empty .github/workflows directory.
Key changes:
- Added
hasActionsWorkflows()function to detect workflows by checking for files in.github/workflows - Modified
getRawLanguagesInRepo()to include "actions" when workflows are detected - Updated function signatures throughout the codebase to pass
sourceRootparameter
Reviewed Changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/config-utils.ts | Implements workflow detection logic and updates language detection functions |
| src/config-utils.test.ts | Updates test calls to include new sourceRoot parameter |
| lib/config-utils.js | Generated JavaScript equivalent of TypeScript changes |
| lib/config-utils.test.js | Generated JavaScript equivalent of test changes |
Comments suppressed due to low confidence (1)
src/config-utils.ts:340
- The function will throw an exception if the
.github/workflowsdirectory doesn't exist, causinglstatSyncto fail. This should be wrapped in a try-catch block or usefs.existsSync()first to check if the path exists before callinglstatSync.
const stats = fs.lstatSync(workflowsPath);
return stats.isDirectory() && fs.readdirSync(workflowsPath).length > 0;
henrymercer
previously approved these changes
Aug 7, 2025
Contributor
henrymercer
left a comment
There was a problem hiding this comment.
We have an implementation of language autodetection in the CLI which I'd like to see us use in the Action too, but given the simplicity of this PR this looks good as a quick fix.
2d62781 to
f28436b
Compare
henrymercer
approved these changes
Aug 7, 2025
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.
This modifies
getRawLanguagesInRepoto automatically detect Actions workflows. Linguist does not class those as a language, and so we failed to automatically detect them before.I chose to implement this by checking for a non-empty
.github/workflowsdirectory, relative tosource-root.Merge / deployment checklist