8000 Work around cache module modifying input paths · Bertg/npm-install@2bcc350 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2bcc350

Browse files
BertgWebeWizard
andauthored
Work around cache module modifying input paths
An issue in action/toolkit modifies the inputPath values passed to cache function. These changes work around this issue. For more details see: actions/toolkit#1378 Co-authored-by: Justin Leis <justin.leis@webewizard.com>
1 parent 9395516 commit 2bcc350

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const restoreCachedNpm = npmCache => {
3131
console.log('trying to restore cached NPM modules')
3232
return cache
3333
.restoreCache(
34-
npmCache.inputPaths,
34+
npmCache.inputPaths.slice(), // Copy inputPaths, to work arround bug reported in https://github.com/actions/toolkit/pull/1378
3535
npmCache.primaryKey,
3636
npmCache.restoreKeys
3737
)
@@ -50,7 +50,10 @@ const saveCachedNpm = npmCache => {
5050
console.log('saving NPM modules')
5151

5252
return cache
53-
.saveCache(npmCache.inputPaths, npmCache.primaryKey)
53+
.saveCache(
54+
npmCache.inputPaths.slice(), // Copy inputPaths, to work arround bug reported in https://github.com/actions/toolkit/pull/1378
55+
npmCache.primaryKey
56+
)
5457
.catch(err => {
5558
// don't throw an error if cache already exists, which may happen due to
5659
// race conditions

0 commit comments

Comments
 (0)
0