From 3630ea6eed1c094d7edb197f1603055a92cb0d76 Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Mon, 20 Feb 2023 12:51:49 +0000 Subject: [PATCH] Fix bug with version shortcircuiting because of version being null --- packages/cache/src/internal/cacheUtils.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/packages/cache/src/internal/cacheUtils.ts b/packages/cache/src/internal/cacheUtils.ts index e413d10d..f9aa379f 100644 --- a/packages/cache/src/internal/cacheUtils.ts +++ b/packages/cache/src/internal/cacheUtils.ts @@ -98,20 +98,13 @@ async function getVersion(app: string, args?: string[]): Promise { // Use zstandard if possible to maximize cache performance export async function getCompressionMethod(): Promise { const versionOutput = await getVersion('zstd', ['--quiet']) - core.debug(`versionOutput: ${versionOutput}`) const version = semver.clean(versionOutput) - core.debug(`version: ${version}`) - - if (!versionOutput.toLowerCase().includes('zstd command line interface')) { - // zstd is not installed - return CompressionMethod.Gzip - } else if (!version || semver.lt(version, 'v1.3.2')) { - // zstd is installed but using a version earlier than v1.3.2 - // v1.3.2 is required to use the `--long` options in zstd + if (version) { return CompressionMethod.ZstdWithoutLong } else { - return CompressionMethod.Zstd + return CompressionMethod.Gzip } + } export function getCacheFileName(compressionMethod: CompressionMethod): string {