diff --git a/src/cache-restore.ts b/src/cache-restore.ts index e138707c2..6ac2cc755 100644 --- a/src/cache-restore.ts +++ b/src/cache-restore.ts @@ -37,7 +37,7 @@ export const restoreCache = async ( ); } - const primaryKey = `node-cache-${platform}-${packageManager}-v2-${fileHash}`; + const primaryKey = `node-cache-${platform}-${packageManager}-${fileHash}`; core.debug(`primary key is ${primaryKey}`); core.saveState(State.CachePrimaryKey, primaryKey); diff --git a/src/cache-utils.ts b/src/cache-utils.ts index c30e65025..8baeb620f 100644 --- a/src/cache-utils.ts +++ b/src/cache-utils.ts @@ -110,11 +110,6 @@ export const getPackageManagerInfo = async (packageManager: string) => { } }; -/** - * glob expanding memoized because it involves potentially very deep - * traversing through the directories tree - */ -export const memoizedCacheDependencies: Record = {}; /** * Expands (converts) the string input `cache-dependency-path` to list of directories that * may be project roots @@ -125,17 +120,8 @@ export const memoizedCacheDependencies: Record = {}; const getProjectDirectoriesFromCacheDependencyPath = async ( cacheDependencyPath: string ): Promise => { - let cacheDependenciesPaths: string[]; - - // memoize unglobbed paths to avoid traversing FS - const memoized = memoizedCacheDependencies[cacheDependencyPath]; - if (memoized) { - cacheDependenciesPaths = memoized; - } else { - const globber = await glob.create(cacheDependencyPath); - cacheDependenciesPaths = await globber.glob(); - memoizedCacheDependencies[cacheDependencyPath] = cacheDependenciesPaths; - } + const globber = await glob.create(cacheDependencyPath); + const cacheDependenciesPaths = await globber.glob(); const existingDirectories: string[] = cacheDependenciesPaths .map(path.dirname) @@ -143,11 +129,8 @@ const getProjectDirectoriesFromCacheDependencyPath = async ( .filter(fs.existsSync) .filter(directory => fs.lstatSync(directory).isDirectory()); - // if user explicitly pointed out some file, but it does not exist it is definitely - // not he wanted, thus we should throw an error not trying to workaround with unexpected - // result to the whole build if (!existingDirectories.length) - throw Error( + core.warning( 'No existing directories found containing `cache-dependency-path`="${cacheDependencyPath}"' );