diff --git a/dist/post_run/index.js b/dist/post_run/index.js index b3f81b6c55..5cf3b28642 100644 --- a/dist/post_run/index.js +++ b/dist/post_run/index.js @@ -583,12 +583,13 @@ function unlinkFile(filePath) { }); } exports.unlinkFile = unlinkFile; -function getVersion(app) { +function getVersion(app, additionalArgs = []) { return __awaiter(this, void 0, void 0, function* () { - core.debug(`Checking ${app} --version`); let versionOutput = ''; + additionalArgs.push('--version'); + core.debug(`Checking ${app} ${additionalArgs.join(' ')}`); try { - yield exec.exec(`${app} --version`, [], { + yield exec.exec(`${app}`, additionalArgs, { ignoreReturnCode: true, silent: true, listeners: { @@ -608,19 +609,14 @@ function getVersion(app) { // Use zstandard if possible to maximize cache performance function getCompressionMethod() { return __awaiter(this, void 0, void 0, function* () { - const versionOutput = yield getVersion('zstd'); + const versionOutput = yield getVersion('zstd', ['--quiet']); const version = semver.clean(versionOutput); - if (!versionOutput.toLowerCase().includes('zstd command line interface')) { - // zstd is not installed + core.debug(`zstd version: ${version}`); + if (versionOutput === '') { return constants_1.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 constants_1.CompressionMethod.ZstdWithoutLong; - } else { - return constants_1.CompressionMethod.Zstd; + return constants_1.CompressionMethod.ZstdWithoutLong; } }); } diff --git a/dist/run/index.js b/dist/run/index.js index b7a245f13a..c3f74935ce 100644 --- a/dist/run/index.js +++ b/dist/run/index.js @@ -583,12 +583,13 @@ function unlinkFile(filePath) { }); } exports.unlinkFile = unlinkFile; -function getVersion(app) { +function getVersion(app, additionalArgs = []) { return __awaiter(this, void 0, void 0, function* () { - core.debug(`Checking ${app} --version`); let versionOutput = ''; + additionalArgs.push('--version'); + core.debug(`Checking ${app} ${additionalArgs.join(' ')}`); try { - yield exec.exec(`${app} --version`, [], { + yield exec.exec(`${app}`, additionalArgs, { ignoreReturnCode: true, silent: true, listeners: { @@ -608,19 +609,14 @@ function getVersion(app) { // Use zstandard if possible to maximize cache performance function getCompressionMethod() { return __awaiter(this, void 0, void 0, function* () { - const versionOutput = yield getVersion('zstd'); + const versionOutput = yield getVersion('zstd', ['--quiet']); const version = semver.clean(versionOutput); - if (!versionOutput.toLowerCase().includes('zstd command line interface')) { - // zstd is not installed + core.debug(`zstd version: ${version}`); + if (versionOutput === '') { return constants_1.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 constants_1.CompressionMethod.ZstdWithoutLong; - } else { - return constants_1.CompressionMethod.Zstd; + return constants_1.CompressionMethod.ZstdWithoutLong; } }); } diff --git a/package-lock.json b/package-lock.json index 9af5ea7451..8eafaa72a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "3.1.0", "license": "MIT", "dependencies": { - "@actions/cache": "^3.1.3", + "@actions/cache": "^3.1.4", "@actions/core": "^1.10.0", "@actions/exec": "^1.1.1", "@actions/github": "^5.1.1", @@ -34,9 +34,9 @@ } }, "node_modules/@actions/cache": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.1.3.tgz", - "integrity": "sha512-5YbATJUS6nVs9EkpK7JaliC3G5koKdJT99NLreL0gJlznudzZzXGNIheW5+HUT9C2DBvubOxYIyfX4v2UpZWrA==", + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.1.4.tgz", + "integrity": "sha512-Uh9wsz7SxunfyqF3UY/wfHI81z97CYQrZs4NU+whzYd0N8emTaloB+XtrAq46X2RbQEOBjF6R090jKQpX4coGg==", "dependencies": { "@actions/core": "^1.10.0", "@actions/exec": "^1.0.1", @@ -3364,9 +3364,9 @@ }, "dependencies": { "@actions/cache": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.1.3.tgz", - "integrity": "sha512-5YbATJUS6nVs9EkpK7JaliC3G5koKdJT99NLreL0gJlznudzZzXGNIheW5+HUT9C2DBvubOxYIyfX4v2UpZWrA==", + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.1.4.tgz", + "integrity": "sha512-Uh9wsz7SxunfyqF3UY/wfHI81z97CYQrZs4NU+whzYd0N8emTaloB+XtrAq46X2RbQEOBjF6R090jKQpX4coGg==", "requires": { "@actions/core": "^1.10.0", "@actions/exec": "^1.0.1", diff --git a/package.json b/package.json index fb16a75d53..c09553829c 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "author": "golangci", "license": "MIT", "dependencies": { - "@actions/cache": "^3.1.3", + "@actions/cache": "^3.1.4", "@actions/core": "^1.10.0", "@actions/exec": "^1.1.1", "@actions/github": "^5.1.1",