Skip to content

Commit

Permalink
Add logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed May 3, 2024
1 parent 6a8624d commit 1c70765
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
5 changes: 4 additions & 1 deletion src/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] {
Expand Down
16 changes: 16 additions & 0 deletions src/cargo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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) {
Expand Down

0 comments on commit 1c70765

Please sign in to comment.