-
Notifications
You must be signed in to change notification settings - Fork 378
Bundle Actions using esbuild #3054
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
It isn't working, and this PR didn't break it. Let's fix it in a separate PR.
This doesn't give us much net new test coverage
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces bundling of the CodeQL Action using esbuild to replace the previous TypeScript compilation approach. The change aims to reduce download times, speed up workflows, and avoid Windows path length issues by consolidating dependencies into fewer files.
Key Changes:
- Migration from TypeScript compilation to esbuild bundling for JavaScript generation
- Complete replacement of all compiled JavaScript files in the
lib
directory - Preservation of the existing module structure and functionality while optimizing the build output
Reviewed Changes
Copilot reviewed 63 out of 23839 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
lib/setup-codeql.test.js | Updated bundled test file for CodeQL setup functionality |
lib/setup-codeql.js | Updated bundled implementation file for CodeQL setup and download logic |
lib/resolve-environment.js | Updated bundled utility for build environment resolution |
lib/repository.js | Updated bundled repository utilities for GitHub repository handling |
lib/overlay-database-utils.test.js | Updated bundled test file for overlay database functionality |
lib/overlay-database-utils.js | Updated bundled implementation for overlay database caching and management |
lib/logging.js | Updated bundled logging utilities for Actions and runner logging |
lib/languages.js | Updated bundled language enumeration definitions |
lib/init.test.js | Updated bundled test file for initialization functionality |
lib/init.js | Updated bundled initialization logic for CodeQL setup |
lib/init-action-post-helper.test.js | Updated bundled test file for post-action helper functionality |
lib/init-action-post-helper.js | Updated bundled post-action cleanup and SARIF upload logic |
lib/git-utils.test.js | Updated bundled test file for Git utilities |
lib/git-utils.js | Updated bundled Git operation utilities |
lib/fingerprints.test.js | Updated bundled test file for SARIF fingerprinting |
lib/fingerprints.js | Updated bundled SARIF fingerprinting implementation |
lib/feature-flags.test.js | Updated bundled test file for feature flag functionality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. I haven't tried this locally, but it looks good.
If I have time later, I'll try checking this PR out and making sure the dev flow still works for me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use npm ci
instead of npm install
in the workflows.
We'll need to update the set of required checks before merging this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's run npm ci
instead of npm install
. Also don't forget to update poackage-lock.json`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid changing the module resolution system — this is tricky and requires us to change a lot of our unit tests.
Note that bundling CJS is less reliable than ESM due to its dynamic nature. ESBuild is designed with ESM in mind, and there has been (at least historically) some gotchas wrt. its CJS bundling.
Is there a different bundler you'd recommend for CJS? I chose ESBuild since it's much faster than webpack and we're using it successfully in other projects, but we could explore something else. |
It looks like the typescript-action template repo uses |
I believe |
|
This means we avoid doing a type checking pass twice
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The esbuild setup looks sound. You will likely want 👀 from somebody else as well as I don't know of the complexities around distributing codeql-action.
As I said, there can be nasty surprises when bundling CJS, so be sure to test various setups.
This PR bundles the Action using esbuild.
Reasoning
node_modules
, specifically the risk that these paths could exceedMAX_PATH
on Windows when checked out.Downsides we should be aware of
Risk assessment
For internal use only. Please select the risk level of this change:
This is a risky change. Things I've done to minimise the risk:
defaults.json
copied over tolib
.Merge / deployment checklist