Skip to content

Commit 1c2dd3b

Browse files
committed
CR
1 parent e68cee1 commit 1c2dd3b

File tree

12 files changed

+123
-434
lines changed

12 files changed

+123
-434
lines changed

lib/cleanup.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
3434
Object.defineProperty(exports, "__esModule", { value: true });
3535
const core = __importStar(require("@actions/core"));
3636
const utils_1 = require("./utils");
37-
const job_summary_utils_1 = require("./job-summary-utils");
37+
const job_summary_1 = require("./job-summary");
3838
function cleanup() {
3939
return __awaiter(this, void 0, void 0, function* () {
4040
if (yield shouldSkipCleanup()) {
@@ -67,7 +67,7 @@ function cleanup() {
6767
function buildInfoPostTasks() {
6868
return __awaiter(this, void 0, void 0, function* () {
6969
const disableAutoBuildPublish = core.getBooleanInput(utils_1.Utils.AUTO_BUILD_PUBLISH_DISABLE);
70-
const disableJobSummary = core.getBooleanInput(utils_1.Utils.JOB_SUMMARY_DISABLE) || !job_summary_utils_1.JobSummaryUtils.isJobSummarySupported();
70+
const disableJobSummary = core.getBooleanInput(utils_1.Utils.JOB_SUMMARY_DISABLE) || !job_summary_1.JobSummary.isJobSummarySupported();
7171
if (disableAutoBuildPublish && disableJobSummary) {
7272
core.info(`Both auto-build-publish and job-summary are disabled. Skipping Build Info post tasks.`);
7373
return;
@@ -95,11 +95,11 @@ function buildInfoPostTasks() {
9595
function hasUnpublishedModules(workingDirectory) {
9696
return __awaiter(this, void 0, void 0, function* () {
9797
// Save the old value of the environment variable to revert it later
98-
const origValue = process.env[job_summary_utils_1.JobSummaryUtils.JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR_ENV];
98+
const origValue = process.env[job_summary_1.JobSummary.JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR_ENV];
9999
try {
100100
core.startGroup('Check for unpublished modules');
101101
// Avoid saving a command summary for this dry-run command
102-
core.exportVariable(job_summary_utils_1.JobSummaryUtils.JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR_ENV, '');
102+
core.exportVariable(job_summary_1.JobSummary.JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR_ENV, '');
103103
// Running build-publish command with a dry-run flag to check if there are any unpublished modules, 'silent' to avoid polluting the logs
104104
const responseStr = yield utils_1.Utils.runCliAndGetOutput(['rt', 'build-publish', '--dry-run'], { cwd: workingDirectory });
105105
// Parse the JSON string to an object
@@ -112,7 +112,7 @@ function hasUnpublishedModules(workingDirectory) {
112112
return false;
113113
}
114114
finally {
115-
core.exportVariable(job_summary_utils_1.JobSummaryUtils.JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR_ENV, origValue);
115+
core.exportVariable(job_summary_1.JobSummary.JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR_ENV, origValue);
116116
core.endGroup();
117117
}
118118
});
@@ -185,10 +185,10 @@ function generateJobSummary() {
185185
try {
186186
core.startGroup('Generating Job Summary');
187187
yield utils_1.Utils.runCli(['generate-summary-markdown']);
188-
yield job_summary_utils_1.JobSummaryUtils.setMarkdownAsJobSummary();
189-
yield job_summary_utils_1.JobSummaryUtils.populateCodeScanningTab();
188+
yield job_summary_1.JobSummary.setMarkdownAsJobSummary();
189+
yield job_summary_1.JobSummary.populateCodeScanningTab();
190190
// Clear files
191-
yield job_summary_utils_1.JobSummaryUtils.clearCommandSummaryDir();
191+
yield job_summary_1.JobSummary.clearCommandSummaryDir();
192192
}
193193
catch (error) {
194194
core.warning('Failed while attempting to generate job summary: ' + error);
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3535
return (mod && mod.__esModule) ? mod : { "default": mod };
3636
};
3737
Object.defineProperty(exports, "__esModule", { value: true });
38-
exports.JobSummaryUtils = void 0;
38+
exports.JobSummary = void 0;
3939
const core = __importStar(require("@actions/core"));
4040
const semver_1 = require("semver");
4141
const core_1 = require("@octokit/core");
@@ -47,7 +47,7 @@ const fs_1 = require("fs");
4747
const http_client_1 = require("@actions/http-client");
4848
const os_1 = require("os");
4949
const utils_1 = require("./utils");
50-
class JobSummaryUtils {
50+
class JobSummary {
5151
/**
5252
* Enabling job summary is done by setting the output dir for the summaries.
5353
* If the output dir is not set, the CLI won't generate the summary Markdown files.
@@ -308,35 +308,35 @@ class JobSummaryUtils {
308308
return process.env.GITHUB_WORKFLOW || '';
309309
}
310310
}
311-
exports.JobSummaryUtils = JobSummaryUtils;
311+
exports.JobSummary = JobSummary;
312312
// Directory name which holds markdown files for the Workflow summary
313-
JobSummaryUtils.JOB_SUMMARY_DIR_NAME = 'jfrog-command-summary';
313+
JobSummary.JOB_SUMMARY_DIR_NAME = 'jfrog-command-summary';
314314
// Directory name which holds security command summary files
315-
JobSummaryUtils.SECURITY_DIR_NAME = 'security';
315+
JobSummary.SECURITY_DIR_NAME = 'security';
316316
// Directory name which holds sarifs files for the code scanning tab
317-
JobSummaryUtils.SARIF_REPORTS_DIR_NAME = 'sarif-reports';
317+
JobSummary.SARIF_REPORTS_DIR_NAME = 'sarif-reports';
318318
// JFrog CLI command summary output directory environment variable
319-
JobSummaryUtils.JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR_ENV = 'JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR';
319+
JobSummary.JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR_ENV = 'JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR';
320320
// Minimum JFrog CLI version supported for job summary command
321-
JobSummaryUtils.MIN_CLI_VERSION_JOB_SUMMARY = '2.66.0';
321+
JobSummary.MIN_CLI_VERSION_JOB_SUMMARY = '2.66.0';
322322
// Code scanning sarif expected file extension.
323-
JobSummaryUtils.CODE_SCANNING_FINAL_SARIF_FILE = 'final.sarif';
323+
JobSummary.CODE_SCANNING_FINAL_SARIF_FILE = 'final.sarif';
324324
// URL for the markdown header image
325325
// This is hosted statically because its usage is outside the context of the JFrog setup action.
326326
// It cannot be linked to the repository, as GitHub serves the image from a CDN,
327327
// which gets blocked by the browser, resulting in an empty image.
328-
JobSummaryUtils.MARKDOWN_HEADER_PNG_URL = 'https://media.jfrog.com/wp-content/uploads/2024/09/02161430/jfrog-job-summary.svg';
328+
JobSummary.MARKDOWN_HEADER_PNG_URL = 'https://media.jfrog.com/wp-content/uploads/2024/09/02161430/jfrog-job-summary.svg';
329329
// Flag to indicate if the summary header is accessible, can be undefined if not checked yet.
330-
JobSummaryUtils.isSummaryHeaderAccessible = undefined;
330+
JobSummary.isSummaryHeaderAccessible = undefined;
331331
// Job ID query parameter key
332-
JobSummaryUtils.JOB_ID_PARAM_KEY = 'job_id';
332+
JobSummary.JOB_ID_PARAM_KEY = 'job_id';
333333
// Run ID query parameter key
334-
JobSummaryUtils.RUN_ID_PARAM_KEY = 'run_id';
334+
JobSummary.RUN_ID_PARAM_KEY = 'run_id';
335335
// Git repository query parameter key
336-
JobSummaryUtils.GIT_REPO_PARAM_KEY = 'git_repo';
336+
JobSummary.GIT_REPO_PARAM_KEY = 'git_repo';
337337
// Source query parameter indicating the source of the request
338-
JobSummaryUtils.SOURCE_PARAM_KEY = 's';
339-
JobSummaryUtils.SOURCE_PARAM_VALUE = '1';
338+
JobSummary.SOURCE_PARAM_KEY = 's';
339+
JobSummary.SOURCE_PARAM_VALUE = '1';
340340
// Metric query parameter indicating the metric type
341-
JobSummaryUtils.METRIC_PARAM_KEY = 'm';
342-
JobSummaryUtils.METRIC_PARAM_VALUE = '1';
341+
JobSummary.METRIC_PARAM_KEY = 'm';
342+
JobSummary.METRIC_PARAM_VALUE = '1';

0 commit comments

Comments
 (0)