Skip to content

Commit

Permalink
CR
Browse files Browse the repository at this point in the history
  • Loading branch information
yahavi committed Jan 18, 2024
1 parent 63de403 commit 9a6fc99
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion lib/cleanup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
24 changes: 11 additions & 13 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/cleanup.ts
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
6 changes: 3 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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<boolean> {
public static addCachedCliToPath(): boolean {
let version: string = core.getInput(Utils.CLI_VERSION_ARG);
if (version === Utils.LATEST_CLI_VERSION) {
version = Utils.LATEST_RELEASE_VERSION;
Expand Down

0 comments on commit 9a6fc99

Please sign in to comment.