Skip to content

Commit

Permalink
CR
Browse files Browse the repository at this point in the history
  • Loading branch information
EyalDelarea committed Dec 26, 2024
1 parent 3be68c0 commit c2e8aee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ class Utils {
}
/**
* Checks if the header image is accessible via the internet.
* saves the result in a static variable to avoid multiple checks.
* Saves the result in a static variable to avoid multiple checks.
* @private
*/
static isHeaderPngAccessible() {
Expand All @@ -839,8 +839,9 @@ class Utils {
const url = this.MARKDOWN_HEADER_PNG_URL;
const httpClient = new http_client_1.HttpClient();
try {
// Set timeout to 5 seconds
const requestOptions = {
socketTimeout: 5000, // Set timeout to 5 seconds
socketTimeout: 5000,
};
const response = yield httpClient.head(url, requestOptions);
this.isSummaryHeaderAccessible = response.message.statusCode === 200;
Expand All @@ -865,7 +866,6 @@ class Utils {
return tempDir;
}
}
exports.Utils = Utils;
// eslint-disable-next-line @typescript-eslint/no-var-requires
Utils.USER_AGENT = 'setup-jfrog-cli-github-action/' + require('../package.json').version;
// Default artifactory URL and repository for downloading JFrog CLI
Expand Down Expand Up @@ -931,3 +931,4 @@ Utils.CUSTOM_SERVER_ID = 'custom-server-id';
Utils.MARKDOWN_HEADER_PNG_URL = 'https://media.jfrog.com/wp-content/uploads/2024/09/02161430/jfrog-job-summary.svg';
// Flag to indicate if the summary header is accessible, can be undefined if not checked yet.
Utils.isSummaryHeaderAccessible = undefined;
exports.Utils = Utils;
5 changes: 3 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ export class Utils {

/**
* Checks if the header image is accessible via the internet.
* saves the result in a static variable to avoid multiple checks.
* Saves the result in a static variable to avoid multiple checks.
* @private
*/
private static async isHeaderPngAccessible(): Promise<boolean> {
Expand All @@ -926,8 +926,9 @@ export class Utils {
const url: string = this.MARKDOWN_HEADER_PNG_URL;
const httpClient: HttpClient = new HttpClient();
try {
// Set timeout to 5 seconds
const requestOptions: OutgoingHttpHeaders = {
socketTimeout: 5000, // Set timeout to 5 seconds
socketTimeout: 5000,
};
const response: HttpClientResponse = await httpClient.head(url, requestOptions);
this.isSummaryHeaderAccessible = response.message.statusCode === 200;
Expand Down

0 comments on commit c2e8aee

Please sign in to comment.