perf: log cache directory sizes for visibility

Log GOMODCACHE and GOCACHE sizes (in human-readable format) after
restore and before save. This helps diagnose cache bloat and monitor
the impact of cache-build settings.

https://claude.ai/code/session_01CqrWSjzGgd7Zi6LyJkd9XW
This commit is contained in:
Claude 2026-04-04 18:17:13 +00:00
parent cf0b11600c
commit 867e185dcc
No known key found for this signature in database
5 changed files with 141 additions and 4 deletions

View file

@ -2,7 +2,11 @@ import * as core from '@actions/core';
import * as cache from '@actions/cache';
import fs from 'fs';
import {State} from './constants';
import {getCacheDirectoryPath, getPackageManagerInfo} from './cache-utils';
import {
getCacheDirectoryPath,
getPackageManagerInfo,
logCacheSizes
} from './cache-utils';
import {computeMetaHash} from './hashdir';
// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in
@ -87,6 +91,8 @@ const cachePackages = async () => {
return;
}
logCacheSizes(cachePaths);
const updatedKey = primaryKey + (buildHash ? `-${buildHash}` : '');
const start = Date.now();
const cacheId = await cache.saveCache(cachePaths, updatedKey);