From 64b8867183597c18966a0dcc8f97f1743fc6b4de Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Tue, 28 Jan 2025 22:02:28 -0800 Subject: [PATCH] fix paths for cache dir --- dist/save/index.js | 23 ++++++++++++++--------- src/save.ts | 24 ++++++++++++++---------- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/dist/save/index.js b/dist/save/index.js index 237cf3f..2d1c5cc 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -87370,14 +87370,20 @@ async function run() { // Save the incremental cache before we delete it if (config.incremental) { core.info(`... Saving incremental cache ...`); - core.debug(`paths include ${config.incrementalPaths} with key ${config.incrementalKey}`); - for (const paths of config.incrementalPaths) { - await saveIncrementalDirs(paths); + try { + core.debug(`paths include ${config.incrementalPaths} with key ${config.incrementalKey}`); + for (const paths of config.incrementalPaths) { + await saveIncrementalDirs(paths); + } + await cacheProvider.cache.saveCache(config.incrementalPaths.slice(), config.incrementalKey); + for (const path of config.incrementalPaths) { + core.debug(` deleting ${path}`); + await (0,promises_.rm)(path); + } } - await cacheProvider.cache.saveCache(config.incrementalPaths.slice(), config.incrementalKey); - for (const path of config.incrementalPaths) { - core.debug(` deleting ${path}`); - await (0,promises_.rm)(path); + catch (e) { + core.debug(`Failed to save incremental cache`); + core.debug(`${e.stack}`); } } const allPackages = []; @@ -87436,9 +87442,8 @@ async function macOsWorkaround() { } catch { } } -async function saveIncrementalDirs(profileDir) { +async function saveIncrementalDirs(incrementalDir) { // Traverse the incremental folder recursively and collect the modified times in a map - const incrementalDir = external_path_default().join(profileDir, "incremental"); const modifiedTimes = new Map(); const fillModifiedTimes = async (dir) => { const dirEntries = await external_fs_default().promises.opendir(dir); diff --git a/src/save.ts b/src/save.ts index 59135db..b452669 100644 --- a/src/save.ts +++ b/src/save.ts @@ -42,14 +42,19 @@ async function run() { // Save the incremental cache before we delete it if (config.incremental) { core.info(`... Saving incremental cache ...`); - core.debug(`paths include ${config.incrementalPaths} with key ${config.incrementalKey}`); - for (const paths of config.incrementalPaths) { - await saveIncrementalDirs(paths); - } - await cacheProvider.cache.saveCache(config.incrementalPaths.slice(), config.incrementalKey); - for (const path of config.incrementalPaths) { - core.debug(` deleting ${path}`); - await rm(path); + try { + core.debug(`paths include ${config.incrementalPaths} with key ${config.incrementalKey}`); + for (const paths of config.incrementalPaths) { + await saveIncrementalDirs(paths); + } + await cacheProvider.cache.saveCache(config.incrementalPaths.slice(), config.incrementalKey); + for (const path of config.incrementalPaths) { + core.debug(` deleting ${path}`); + await rm(path); + } + } catch (e) { + core.debug(`Failed to save incremental cache`); + core.debug(`${(e as any).stack}`); } } @@ -112,9 +117,8 @@ async function macOsWorkaround() { } -async function saveIncrementalDirs(profileDir: string) { +async function saveIncrementalDirs(incrementalDir: string) { // Traverse the incremental folder recursively and collect the modified times in a map - const incrementalDir = path.join(profileDir, "incremental"); const modifiedTimes = new Map(); const fillModifiedTimes = async (dir: string) => { const dirEntries = await fs.promises.opendir(dir);