chore(ci): convert the scripts in .github/scripts to ESM - #5640
Open
svozza wants to merge 1 commit into
Open
Conversation
2 tasks
svozza
force-pushed
the
chore/5639-scripts-esm
branch
from
September 5, 2026 12:11
95006ee to
89699cd
Compare
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.
Summary
The scripts under
.github/scriptswere CommonJS, pinned by a localpackage.jsonwith"type": "commonjs", while the rest of the repo is ESM. This PR flips that directory to ESM and converts the three scripts and their call sites, so the directory has one module system and new scripts such as the workspace resolver in #5638 can be plain.jsfiles.Changes
.github/scripts/package.jsonis deleted. It existed only to pin the directory to CommonJS after the root went ESM (chore: switch codebase to default esm #3959); with it gone the scripts inherit"type": "module"from the rootpackage.json. File names are unchanged, so the fifteenprepackentries that run the release patch script are untouched.release_patch_package_json.js:requirereplaced withimport; behaviour unchanged.post_release.js: the handler is the module's default export.report_e2e_sweep.js:formatReportis a named export and the reporter is the default export.post-release.ymland thenotifyjob insweep-stale-e2e-stacks.yml: theactions/github-scriptsteps load the modules withawait import()on agithub.workspacepath, the form documented in the action's README, since the snippet itself is evaluated as CommonJS.sweep-stale-e2e-stacks.ymlruns itsnode <<'NODE'heredoc with--input-type=moduleand a staticimport, because stdin scripts default to CommonJS.Verified locally: the release patch script against a copy of a package manifest produces the same trimmed output; both
github-scriptmodules import by absolute path with the expected exports; the summary heredoc renders a report from the repo root; Biome and actionlint pass. Thepost-release.ymlpath only executes after a release, so triggering the stale-stack sweep workflow manually after merge is the cheapest way to exercise theawait import()form in a real run.Issue number: closes #5639
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.