Add logs.

This commit is contained in:
Miles Johnson 2024-05-03 11:51:38 -07:00
parent 6a8624d80a
commit 1c70765f66
3 changed files with 21 additions and 2 deletions

View file

@ -1,6 +1,6 @@
{
"name": "@moonrepo/setup-rust",
"version": "1.0.3",
"version": "1.2.0",
"description": "A GitHub action for setting up Rust and Cargo.",
"main": "dist/index.js",
"scripts": {

View file

@ -22,7 +22,10 @@ export function getTargetPaths(): string[] {
const profile = getCacheTarget();
const dirs = core.getInput('target-dirs', { required: true }).split(',');
return dirs.filter((dir) => dir.trim()).map((dir) => path.join(WORKSPACE_ROOT, dir, profile));
return dirs
.map((dir) => dir.trim())
.filter(Boolean)
.map((dir) => path.join(WORKSPACE_ROOT, dir, profile));
}
export function getCachePaths(): string[] {

View file

@ -179,6 +179,13 @@ export async function saveCache() {
core.info(`Saving cache with key ${primaryKey}`);
core.debug(`Cache key: ${primaryKey}`);
core.debug('Cache paths:');
for (const cachePath of cachePaths) {
core.debug(`- ${cachePath}`);
}
await cache.saveCache(cachePaths, primaryKey);
}
@ -190,6 +197,15 @@ export async function restoreCache() {
core.info('Attempting to restore cache');
const primaryKey = await getPrimaryCacheKey();
const cachePaths = getCachePaths();
core.debug(`Cache key: ${primaryKey}`);
core.debug('Cache paths:');
for (const cachePath of cachePaths) {
core.debug(`- ${cachePath}`);
}
const cacheKey = await cache.restoreCache(getCachePaths(), primaryKey, getCachePrefixes());
if (cacheKey) {