1
0
Fork 0

Fix bug with version shortcircuiting because of version being null

pull/1353/head
Lovepreet Singh 2023-02-20 12:51:49 +00:00
parent c2d3089f83
commit 3630ea6eed
1 changed files with 3 additions and 10 deletions

View File

@ -98,20 +98,13 @@ async function getVersion(app: string, args?: string[]): Promise<string> {
// Use zstandard if possible to maximize cache performance // Use zstandard if possible to maximize cache performance
export async function getCompressionMethod(): Promise<CompressionMethod> { export async function getCompressionMethod(): Promise<CompressionMethod> {
const versionOutput = await getVersion('zstd', ['--quiet']) const versionOutput = await getVersion('zstd', ['--quiet'])
core.debug(`versionOutput: ${versionOutput}`)
const version = semver.clean(versionOutput) const version = semver.clean(versionOutput)
core.debug(`version: ${version}`) if (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
return CompressionMethod.ZstdWithoutLong return CompressionMethod.ZstdWithoutLong
} else { } else {
return CompressionMethod.Zstd return CompressionMethod.Gzip
} }
} }
export function getCacheFileName(compressionMethod: CompressionMethod): string { export function getCacheFileName(compressionMethod: CompressionMethod): string {