From 8e239763e56a316b4ad7db386bab17de58661634 Mon Sep 17 00:00:00 2001 From: Sampark Sharma Date: Tue, 3 Jan 2023 11:46:51 +0000 Subject: [PATCH] Address review comments --- packages/cache/src/internal/cacheHttpClient.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/cache/src/internal/cacheHttpClient.ts b/packages/cache/src/internal/cacheHttpClient.ts index fea000a6..b54e791d 100644 --- a/packages/cache/src/internal/cacheHttpClient.ts +++ b/packages/cache/src/internal/cacheHttpClient.ts @@ -77,12 +77,17 @@ export function getCacheVersion( enableCrossOsArchive = false ): string { const components = paths - .concat(!compressionMethod ? [] : [compressionMethod]) - .concat( - process.platform !== 'win32' || enableCrossOsArchive - ? [] - : ['windows-only'] - ) // Only check for windows platforms if enableCrossOsArchive is false + + // Add compression method to cache version to restore + // compressed cache as per compression method + if (compressionMethod) { + components.push(compressionMethod) + } + + // Only check for windows platforms if enableCrossOsArchive is false + if (process.platform === 'win32' && !enableCrossOsArchive) { + components.push('windows-only') + } // Add salt to cache version to support breaking changes in cache entry components.push(versionSalt)