diff --git a/package.json b/package.json index e0add0f..c1ecad7 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/cache.ts b/src/cache.ts index 5dc0190..3a63c80 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -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[] { diff --git a/src/cargo.ts b/src/cargo.ts index 01a4883..d8f3732 100644 --- a/src/cargo.ts +++ b/src/cargo.ts @@ -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) {