Action size: Minify JS bundle on release branches#3920
Draft
henrymercer wants to merge 1 commit into
Draft
Conversation
|
|
||
| // If we don't seem to be running as part of the release automation, then only minify if we're on | ||
| // a release branch. | ||
| const refName = process.env.GITHUB_REF_NAME || localBranch; |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces the size of the built JavaScript shipped on release branches by enabling esbuild minification when building for releases/v* (and related release-automation branches), while keeping main builds unminified to avoid high-churn bundle conflicts in day-to-day development.
Changes:
- Add release-branch-aware minification logic to
build.mjs(with an env override). - Update release automation to rebuild the Action whenever the merge is conflict-free.
- Document the behavior change in the changelog.
Show a summary per file
| File | Description |
|---|---|
| CHANGELOG.md | Adds a release note describing minified bundles on release branches. |
| build.mjs | Detects release/release-automation branches and conditionally enables esbuild minification. |
| .github/update-release-branch.py | Ensures release automation rebuilds the Action on conflict-free merges so minified artifacts are produced when appropriate. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 3
| function shouldMinify() { | ||
| const override = process.env.CODEQL_ACTION_MINIFY; | ||
| if (override === "true") return true; | ||
| if (override === "false") return false; |
Comment on lines
+53
to
+56
| return execFileSync("git", ["rev-parse", "--abbrev-ref", "HEAD"], { | ||
| encoding: "utf-8", | ||
| stdio: ["pipe", "pipe", "ignore"], | ||
| }).trim(); |
| # For backports, the only source-level change vs the source branch is the new version number, | ||
| # so we just need to refresh the version embedded in `lib/`. | ||
| run_command('npm', 'ci') | ||
| # We only expect changes to the JavaScript output, rebuilding e.g. the PR checks is unnecessary. |
Member
|
High-level comment: consider how minification may affect stack traces and whether that is worth an extra 20% reduction in size. |
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.
Minify the JS bundle on release branches to reduce the size of the
.tar.gz'd Action checkout by a further ~20%.Risk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
Workflow types:
dynamicworkflows (Default Setup, Code Quality, ...).Products:
analysis-kinds: code-scanning.analysis-kinds: code-quality.upload-sarifaction.Environments:
github.comand/or GitHub Enterprise Cloud with Data Residency.How did/will you validate this change?
.test.tsfiles).pr-checks).If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
Merge / deployment checklist