From 9a6fc997b1014da3f0bfa88a3f559054157d2d05 Mon Sep 17 00:00:00 2001 From: yahavi Date: Thu, 18 Jan 2024 18:38:48 +0200 Subject: [PATCH] CR --- lib/cleanup.js | 2 +- lib/utils.js | 24 +++++++++++------------- src/cleanup.ts | 4 ++-- src/utils.ts | 6 +++--- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/lib/cleanup.js b/lib/cleanup.js index 29922f239..12761e797 100644 --- a/lib/cleanup.js +++ b/lib/cleanup.js @@ -38,7 +38,7 @@ function cleanup() { return __awaiter(this, void 0, void 0, function* () { try { core.startGroup('Cleanup JFrog CLI servers configuration'); - if (!(yield utils_1.Utils.addCachedCliToPath())) { + if (!utils_1.Utils.addCachedCliToPath()) { return; } yield utils_1.Utils.removeJFrogServers(); diff --git a/lib/utils.js b/lib/utils.js index e2622b7d6..73cc6b396 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -178,19 +178,17 @@ class Utils { * Fetch the JFrog CLI path from the tool cache and append it to the PATH environment variable. Employ this approach during the cleanup phase. */ static addCachedCliToPath() { - return __awaiter(this, void 0, void 0, function* () { - let version = core.getInput(Utils.CLI_VERSION_ARG); - if (version === Utils.LATEST_CLI_VERSION) { - version = Utils.LATEST_RELEASE_VERSION; - } - let jfrogCliPath = toolCache.find(Utils.getJfExecutableName(), version); - if (!jfrogCliPath) { - core.warning(`Could not find JFrog CLI version '${version}' in tool cache`); - return false; - } - core.addPath(jfrogCliPath); - return true; - }); + let version = core.getInput(Utils.CLI_VERSION_ARG); + if (version === Utils.LATEST_CLI_VERSION) { + version = Utils.LATEST_RELEASE_VERSION; + } + let jfrogCliPath = toolCache.find(Utils.getJfExecutableName(), version); + if (!jfrogCliPath) { + core.warning(`Could not find JFrog CLI version '${version}' in tool cache`); + return false; + } + core.addPath(jfrogCliPath); + return true; } /** * Try to load the JFrog CLI executables from cache. diff --git a/src/cleanup.ts b/src/cleanup.ts index ce6034bd3..d6c794b69 100644 --- a/src/cleanup.ts +++ b/src/cleanup.ts @@ -1,10 +1,10 @@ import * as core from '@actions/core'; -import { JfrogCredentials, Utils } from './utils'; +import { Utils } from './utils'; async function cleanup() { try { core.startGroup('Cleanup JFrog CLI servers configuration'); - if (!(await Utils.addCachedCliToPath())) { + if (!Utils.addCachedCliToPath()) { return; } await Utils.removeJFrogServers(); diff --git a/src/utils.ts b/src/utils.ts index 085120fc7..ce031da52 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,12 +1,12 @@ import * as core from '@actions/core'; import { exec } from '@actions/exec'; +import { HttpClient, HttpClientResponse } from '@actions/http-client'; import * as toolCache from '@actions/tool-cache'; import { chmodSync } from 'fs'; +import { OutgoingHttpHeaders } from 'http'; import { arch, platform } from 'os'; import { join } from 'path'; import { lt } from 'semver'; -import { HttpClient, HttpClientResponse } from '@actions/http-client'; -import { OutgoingHttpHeaders } from 'http'; export class Utils { // eslint-disable-next-line @typescript-eslint/no-var-requires @@ -182,7 +182,7 @@ export class Utils { /** * Fetch the JFrog CLI path from the tool cache and append it to the PATH environment variable. Employ this approach during the cleanup phase. */ - public static async addCachedCliToPath(): Promise { + public static addCachedCliToPath(): boolean { let version: string = core.getInput(Utils.CLI_VERSION_ARG); if (version === Utils.LATEST_CLI_VERSION) { version = Utils.LATEST_RELEASE_VERSION;