perf: add cache-build option and upgrade to v6.2.0

Add `cache-build` input (default: false) to control whether GOCACHE is
included in the cache. This dramatically reduces cache size from ~1.2GB
to ~200-400MB by excluding build artifacts that have low reuse across
code changes.

Also upgrades dependencies (@actions/cache v5, semver v7.7) and runtime
to node24 to align with upstream actions/setup-go.

https://claude.ai/code/session_01CqrWSjzGgd7Zi6LyJkd9XW
This commit is contained in:
Claude 2026-04-04 17:58:19 +00:00
parent f21630a9ad
commit cf0b11600c
No known key found for this signature in database
9 changed files with 198948 additions and 67104 deletions

View file

@ -46,8 +46,12 @@ const cachePackages = async () => {
const prevBuildHash = core.getState(State.CacheBuildHash);
const packageManagerInfo = await getPackageManagerInfo(packageManager);
const cacheBuild = core.getBooleanInput('cache-build');
const cachePaths = await getCacheDirectoryPath(packageManagerInfo);
const cachePaths = await getCacheDirectoryPath(
packageManagerInfo,
cacheBuild
);
const nonExistingPaths = cachePaths.filter(
cachePath => !fs.existsSync(cachePath)
@ -73,7 +77,8 @@ const cachePackages = async () => {
return;
}
const buildHash = computeMetaHash([cachePaths[1]]);
const buildHash =
cachePaths.length > 1 ? computeMetaHash([cachePaths[1]]) : '';
if (primaryKey === state && buildHash === prevBuildHash) {
core.info(