Skip to content

Commit

Permalink
fix: print better cache miss
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Feb 14, 2024
1 parent f94f332 commit 3da6b44
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
11 changes: 9 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
11 changes: 9 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down

0 comments on commit 3da6b44

Please sign in to comment.