chore: update @actions/core to v3 and migrate to ESM #73
Reference in New Issue
Block a user
Delete Branch "update-actions-core-v3"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR updates the
@actions/coredependency from v2 to v3.0.0.Major Changes:
@actions/coretov3.0.0inpackage.json.@actions/corev3 is an ESM-only package and does not provide CommonJS exports.package.jsonupdates: Added"type": "module"and updated the dependency version.index.jsto useimportandexport.import.meta.urlfor ESM compatibility.__tests__/index.test.jsto use ESM imports for compatibility with the updated source code.dist/index.jsbundle usingnccto reflect the changes.node20inaction.yaml), which is fully compatible with these changes.Why these changes are needed:
@actions/corev3 brings latest improvements and fixes from the GitHub Actions toolkit.@actions/corev3.Verified with
npm testandnpm run build.PR Reviewer Guide 🔍
Here are some key observations to aid the review process:
Main execution check
The ESM-based invocation guard
if (process.argv[1] === __filename)may not reliably detect module execution in all scenarios (e.g., bundled output, symlinked paths, or when running fromdist/index.js). Consider using a pattern based on comparingimport.meta.urlor explicitly converting and normalizing paths withfileURLToPath(import.meta.url)for consistency.Missing import
The call to
fileURLToPath(import.meta.url)requires importing it from the'url'module. Ensure you haveimport { fileURLToPath } from 'url';at the top, or else__filenamewill be undefined and break the execution guard.Root module type
The PR adds
"type": "module"indist/package.jsonbut the rootpackage.jsondiff doesn't show it. Verify that the root manifest declares"type": "module"so Node treats all source files as ESM.Probably correct should be tested directly after merge!
@@ -0,0 +1,3 @@{Is this file needed? I need an explation about it.