Upgrade to @actions/cache@6, @actions/core@3 and migrate to ESM for Node.js 24#5
Upgrade to @actions/cache@6, @actions/core@3 and migrate to ESM for Node.js 24#5
Conversation
Agent-Logs-Url: https://github.com/HiGarfield/cachewrtbuild/sessions/a5fc326c-ded7-4cb4-a1e6-b274ff13d16c Co-authored-by: HiGarfield <32226909+HiGarfield@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Migrates the GitHub Action codebase to ESM to support ESM-only @actions/cache@6 and @actions/core@3, and updates CI for the Node.js 24 runtime.
Changes:
- Converted CommonJS
require/module.exportsusage to ESMimport/exportand introduced top-level execution. - Replaced custom boolean parsing with
core.getBooleanInput()and removed shell-based timestamping. - Updated CI workflow actions to latest versions and pinned Node.js to
24.
Reviewed changes
Copilot reviewed 2 out of 5625 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| fetch.js | Converts to ESM imports/top-level execution and updates input parsing + timestamp generation. |
| .github/workflows/licensed.yml | Updates checkout action and adds Node.js 24 setup for CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import * as core from "@actions/core"; | ||
| import { execSync } from "node:child_process"; | ||
| import * as cache from "@actions/cache"; | ||
| import { buildBaseConfig } from "./utils.js"; |
There was a problem hiding this comment.
execSync is still imported but the timestamp logic was switched to Date.now(), so execSync is no longer used in this file. Remove the node:child_process import to avoid dead code and keep the module dependency surface minimal.
There was a problem hiding this comment.
The execSync import is still needed — it's used on lines 35-36 for the sed commands that skip toolchain building. The reviewer's suggestion was incorrect; removing the import would break the action when cacheToolchain && skipBuildingToolchain is true.
| if (!cleanUpCache) { | ||
| const { keyString: baseKey, paths, cacheToolchain, cacheCcache } = buildBaseConfig(); | ||
| const skipBuildingToolchain = parseBooleanInput(core.getInput("skip"), true); | ||
| const skipBuildingToolchain = core.getBooleanInput("skip"); |
There was a problem hiding this comment.
This changes the default/accepted values behavior for skip: previously parseBooleanInput(core.getInput(\"skip\"), true) implies a default of true (and possibly more permissive parsing like 1/0, depending on the removed helper). core.getBooleanInput(\"skip\") returns false when the input is absent and throws on invalid values, which may inadvertently flip behavior or break existing users. To preserve prior semantics, either set default: 'true' for skip in action.yml (preferred) or explicitly implement a true fallback when the input is unset while keeping strict validation consistent with your intended UX.
| const skipBuildingToolchain = core.getBooleanInput("skip"); | |
| const skipInput = core.getInput("skip"); | |
| let skipBuildingToolchain: boolean; | |
| if (skipInput === "") { | |
| // Preserve previous semantics: default to true when input is unset | |
| skipBuildingToolchain = true; | |
| } else if (/^(true|1)$/i.test(skipInput)) { | |
| skipBuildingToolchain = true; | |
| } else if (/^(false|0)$/i.test(skipInput)) { | |
| skipBuildingToolchain = false; | |
| } else { | |
| throw new Error( | |
| "Invalid value for 'skip'. Expected one of: 'true', 'false', '1', '0', or empty (defaults to true)." | |
| ); | |
| } |
Both
@actions/cache@6and@actions/core@3are ESM-only. This requires a full CommonJS → ESM migration of the codebase to remain compatible with the latest dependency versions and thenode24runtime.Dependencies
@actions/cache4.0.x → 6.0.0@actions/core1.11.x → 3.0.0ESM migration
"type": "module"topackage.jsonrequire()/module.exports→import/exportnode:protocol prefixawaitCode cleanup
parseBooleanInput()— replaced bycore.getBooleanInput()from@actions/core@3execSync("date +%s")withMath.floor(Date.now() / 1000)klever1988→HiGarfieldCI
actions/checkout@v2→v4, addedactions/setup-node@v4withnode-version: '24'