Skip uploading empty caches

This commit is contained in:
Michael B. Gale 2024-07-26 13:42:40 +01:00
parent 5b057af8ce
commit f3714aed1f
No known key found for this signature in database
GPG key ID: FF5E2765BD00628F
3 changed files with 15 additions and 1 deletions

View file

@ -125,6 +125,11 @@ async function uploadDependencyCaches(config, logger) {
continue;
}
const size = await (0, caching_utils_1.getTotalCacheSize)(cacheConfig.paths, logger);
// Skip uploading an empty cache.
if (size === 0) {
logger.info(`Skipping upload of dependency cache for ${language} since it is empty.`);
continue;
}
const key = await cacheKey(language, cacheConfig);
logger.info(`Uploading cache of size ${size} for ${language} with key ${key}`);
await actionsCache.saveCache(cacheConfig.paths, key);