From 3da6b44b121fcdcb64528100e3dcfaffb39159e5 Mon Sep 17 00:00:00 2001 From: Gleb Bahmutov Date: Tue, 13 Feb 2024 22:49:04 -0500 Subject: [PATCH] fix: print better cache miss --- dist/index.js | 11 +++++++++-- index.js | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 3457038..9f647e1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -36,14 +36,21 @@ const getInputBool = (name, defaultValue = false) => { const restoreCachedNpm = npmCache => { console.log('trying to restore cached NPM modules') + console.log('cache key %s', npmCache.primaryKey) + console.log('restore keys %o', npmCache.restoreKeys) + console.log('input paths %o', npmCache.inputPaths) return cache .restoreCache( - npmCache.inputPaths.slice(), // Copy inputPaths, to work arround bug reported in https://github.com/actions/toolkit/pull/1378 + npmCache.inputPaths, npmCache.primaryKey, npmCache.restoreKeys ) .then(cache => { - console.log('npm cache hit', cache) + if (typeof cache === 'undefined') { + console.log('npm cache miss') + } else { + console.log('npm cache hit key', cache) + } return cache }) .catch(e => { diff --git a/index.js b/index.js index 019dcd7..ef67672 100644 --- a/index.js +++ b/index.js @@ -29,14 +29,21 @@ const getInputBool = (name, defaultValue = false) => { const restoreCachedNpm = npmCache => { console.log('trying to restore cached NPM modules') + console.log('cache key %s', npmCache.primaryKey) + console.log('restore keys %o', npmCache.restoreKeys) + console.log('input paths %o', npmCache.inputPaths) return cache .restoreCache( - npmCache.inputPaths.slice(), // Copy inputPaths, to work arround bug reported in https://github.com/actions/toolkit/pull/1378 + npmCache.inputPaths, npmCache.primaryKey, npmCache.restoreKeys ) .then(cache => { - console.log('npm cache hit', cache) + if (typeof cache === 'undefined') { + console.log('npm cache miss') + } else { + console.log('npm cache hit key', cache) + } return cache }) .catch(e => {