Use `cachePathList` to iterate over multiple cache paths

Signed-off-by: Kipras Melnikovas <kipras@kipras.org>
pull/180/head
Kipras Melnikovas 6 years ago
parent 9a9c8d77fd
commit 197962b975
No known key found for this signature in database
GPG Key ID: AA505BC1C6D8AD90

@ -56,30 +56,32 @@ async function run(): Promise<void> {
cachePathList = [cachePath, ...cachePathList];
core.debug(`Cache Path: ${cachePath}`);
for (const cachePath of cachePathList) {
core.debug(`Cache Path: ${cachePath}`);
const archivePath = path.join(
await utils.createTempDirectory(),
"cache.tgz"
);
core.debug(`Archive Path: ${archivePath}`);
const archivePath = path.join(
await utils.createTempDirectory(),
"cache.tgz"
);
core.debug(`Archive Path: ${archivePath}`);
await createTar(archivePath, cachePath);
await createTar(archivePath, cachePath);
const fileSizeLimit = 5 * 1024 * 1024 * 1024; // 5GB per repo limit
const archiveFileSize = utils.getArchiveFileSize(archivePath);
core.debug(`File Size: ${archiveFileSize}`);
if (archiveFileSize > fileSizeLimit) {
utils.logWarning(
`Cache size of ~${Math.round(
archiveFileSize / (1024 * 1024)
)} MB (${archiveFileSize} B) is over the 5GB limit, not saving cache.`
);
return;
}
const fileSizeLimit = 5 * 1024 * 1024 * 1024; // 5GB per repo limit
const archiveFileSize = utils.getArchiveFileSize(archivePath);
core.debug(`File Size: ${archiveFileSize}`);
if (archiveFileSize > fileSizeLimit) {
utils.logWarning(
`Cache size of ~${Math.round(
archiveFileSize / (1024 * 1024)
)} MB (${archiveFileSize} B) is over the 5GB limit, not saving cache.`
);
return;
}
core.debug(`Saving Cache (ID: ${cacheId})`);
await cacheHttpClient.saveCache(cacheId, archivePath);
core.debug(`Saving Cache (ID: ${cacheId})`);
await cacheHttpClient.saveCache(cacheId, archivePath);
}
} catch (error) {
utils.logWarning(error.message);
}

Loading…
Cancel
Save