Skip to content

Commit

Permalink
Build outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
bigdaz committed Jan 1, 2024
1 parent 4447437 commit b19d228
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 28 deletions.
57 changes: 44 additions & 13 deletions dist/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -140342,7 +140342,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DependencyGraphOption = exports.parseNumericInput = exports.getArtifactRetentionDays = exports.getDependencyGraphOption = exports.isDependencyGraphEnabled = exports.isPRCommentEnabled = exports.isJobSummaryEnabled = exports.getGithubToken = exports.getJobMatrix = exports.getArguments = exports.getGradleExecutable = exports.getGradleVersion = exports.getBuildRootDirectory = exports.getCacheExcludes = exports.getCacheIncludes = exports.getCacheEncryptionKey = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheStrictMatch = exports.isCacheOverwriteExisting = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
exports.JobSummaryOption = exports.DependencyGraphOption = exports.parseNumericInput = exports.getArtifactRetentionDays = exports.getDependencyGraphOption = exports.getPRCommentOption = exports.getJobSummaryOption = exports.isJobSummaryEnabled = exports.getGithubToken = exports.getJobMatrix = exports.getArguments = exports.getGradleExecutable = exports.getGradleVersion = exports.getBuildRootDirectory = exports.getCacheExcludes = exports.getCacheIncludes = exports.getCacheEncryptionKey = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheStrictMatch = exports.isCacheOverwriteExisting = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
const core = __importStar(__nccwpck_require__(42186));
const string_argv_1 = __nccwpck_require__(19663);
function isCacheDisabled() {
Expand Down Expand Up @@ -140414,14 +140414,26 @@ function isJobSummaryEnabled() {
return getBooleanInput('generate-job-summary', true);
}
exports.isJobSummaryEnabled = isJobSummaryEnabled;
function isPRCommentEnabled() {
return getBooleanInput('add-pr-comment', false);
function getJobSummaryOption() {
return parseJobSummaryOption('add-job-summary');
}
exports.isPRCommentEnabled = isPRCommentEnabled;
function isDependencyGraphEnabled() {
return getBooleanInput('generate-dependency-graph', true);
exports.getJobSummaryOption = getJobSummaryOption;
function getPRCommentOption() {
return parseJobSummaryOption('add-job-summary-as-pr-commment');
}
exports.getPRCommentOption = getPRCommentOption;
function parseJobSummaryOption(paramName) {
const val = core.getInput(paramName);
switch (val.toLowerCase().trim()) {
case 'never':
return JobSummaryOption.Never;
case 'always':
return JobSummaryOption.Always;
case 'on-failure':
return JobSummaryOption.OnFailure;
}
throw TypeError(`The value '${val} is not valid for 'paramName. Valid values are: [never, always, on-failure].`);
}
exports.isDependencyGraphEnabled = isDependencyGraphEnabled;
function getDependencyGraphOption() {
const val = core.getInput('dependency-graph');
switch (val.toLowerCase().trim()) {
Expand Down Expand Up @@ -140475,6 +140487,12 @@ var DependencyGraphOption;
DependencyGraphOption["GenerateAndUpload"] = "generate-and-upload";
DependencyGraphOption["DownloadAndSubmit"] = "download-and-submit";
})(DependencyGraphOption || (exports.DependencyGraphOption = DependencyGraphOption = {}));
var JobSummaryOption;
(function (JobSummaryOption) {
JobSummaryOption["Never"] = "never";
JobSummaryOption["Always"] = "always";
JobSummaryOption["OnFailure"] = "on-failure";
})(JobSummaryOption || (exports.JobSummaryOption = JobSummaryOption = {}));


/***/ }),
Expand Down Expand Up @@ -140527,7 +140545,7 @@ function generateJobSummary(buildResults, cacheListener) {
return __awaiter(this, void 0, void 0, function* () {
const summaryTable = renderSummaryTable(buildResults);
const cachingReport = (0, cache_reporting_1.generateCachingReport)(cacheListener);
if (shouldGenerateJobSummary()) {
if (shouldGenerateJobSummary(buildResults)) {
core.info('Generating Job Summary');
core.summary.addRaw(summaryTable);
core.summary.addRaw(cachingReport);
Expand All @@ -140540,7 +140558,7 @@ function generateJobSummary(buildResults, cacheListener) {
core.info(cachingReport);
core.info('============================');
}
if (shouldAddPRComment()) {
if (shouldAddPRComment(buildResults)) {
yield addPRComment(summaryTable);
}
});
Expand Down Expand Up @@ -140612,14 +140630,27 @@ function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`;
}
function shouldGenerateJobSummary() {
function shouldGenerateJobSummary(buildResults) {
if (!process.env[summary_1.SUMMARY_ENV_VAR]) {
return false;
}
return params.isJobSummaryEnabled();
if (!params.isJobSummaryEnabled()) {
return false;
}
return shouldAddJobSummary(params.getJobSummaryOption(), buildResults);
}
function shouldAddPRComment() {
return params.isPRCommentEnabled();
function shouldAddPRComment(buildResults) {
return shouldAddJobSummary(params.getPRCommentOption(), buildResults);
}
function shouldAddJobSummary(option, buildResults) {
switch (option) {
case params.JobSummaryOption.Always:
return true;
case params.JobSummaryOption.Never:
return false;
case params.JobSummaryOption.OnFailure:
return buildResults.find(result => result.buildFailed) !== undefined;
}
}


Expand Down
2 changes: 1 addition & 1 deletion dist/main/index.js.map

Large diffs are not rendered by default.

57 changes: 44 additions & 13 deletions dist/post/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -137663,7 +137663,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DependencyGraphOption = exports.parseNumericInput = exports.getArtifactRetentionDays = exports.getDependencyGraphOption = exports.isDependencyGraphEnabled = exports.isPRCommentEnabled = exports.isJobSummaryEnabled = exports.getGithubToken = exports.getJobMatrix = exports.getArguments = exports.getGradleExecutable = exports.getGradleVersion = exports.getBuildRootDirectory = exports.getCacheExcludes = exports.getCacheIncludes = exports.getCacheEncryptionKey = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheStrictMatch = exports.isCacheOverwriteExisting = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
exports.JobSummaryOption = exports.DependencyGraphOption = exports.parseNumericInput = exports.getArtifactRetentionDays = exports.getDependencyGraphOption = exports.getPRCommentOption = exports.getJobSummaryOption = exports.isJobSummaryEnabled = exports.getGithubToken = exports.getJobMatrix = exports.getArguments = exports.getGradleExecutable = exports.getGradleVersion = exports.getBuildRootDirectory = exports.getCacheExcludes = exports.getCacheIncludes = exports.getCacheEncryptionKey = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheStrictMatch = exports.isCacheOverwriteExisting = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
const core = __importStar(__nccwpck_require__(42186));
const string_argv_1 = __nccwpck_require__(19663);
function isCacheDisabled() {
Expand Down Expand Up @@ -137735,14 +137735,26 @@ function isJobSummaryEnabled() {
return getBooleanInput('generate-job-summary', true);
}
exports.isJobSummaryEnabled = isJobSummaryEnabled;
function isPRCommentEnabled() {
return getBooleanInput('add-pr-comment', false);
function getJobSummaryOption() {
return parseJobSummaryOption('add-job-summary');
}
exports.isPRCommentEnabled = isPRCommentEnabled;
function isDependencyGraphEnabled() {
return getBooleanInput('generate-dependency-graph', true);
exports.getJobSummaryOption = getJobSummaryOption;
function getPRCommentOption() {
return parseJobSummaryOption('add-job-summary-as-pr-commment');
}
exports.getPRCommentOption = getPRCommentOption;
function parseJobSummaryOption(paramName) {
const val = core.getInput(paramName);
switch (val.toLowerCase().trim()) {
case 'never':
return JobSummaryOption.Never;
case 'always':
return JobSummaryOption.Always;
case 'on-failure':
return JobSummaryOption.OnFailure;
}
throw TypeError(`The value '${val} is not valid for 'paramName. Valid values are: [never, always, on-failure].`);
}
exports.isDependencyGraphEnabled = isDependencyGraphEnabled;
function getDependencyGraphOption() {
const val = core.getInput('dependency-graph');
switch (val.toLowerCase().trim()) {
Expand Down Expand Up @@ -137796,6 +137808,12 @@ var DependencyGraphOption;
DependencyGraphOption["GenerateAndUpload"] = "generate-and-upload";
DependencyGraphOption["DownloadAndSubmit"] = "download-and-submit";
})(DependencyGraphOption || (exports.DependencyGraphOption = DependencyGraphOption = {}));
var JobSummaryOption;
(function (JobSummaryOption) {
JobSummaryOption["Never"] = "never";
JobSummaryOption["Always"] = "always";
JobSummaryOption["OnFailure"] = "on-failure";
})(JobSummaryOption || (exports.JobSummaryOption = JobSummaryOption = {}));


/***/ }),
Expand Down Expand Up @@ -137848,7 +137866,7 @@ function generateJobSummary(buildResults, cacheListener) {
return __awaiter(this, void 0, void 0, function* () {
const summaryTable = renderSummaryTable(buildResults);
const cachingReport = (0, cache_reporting_1.generateCachingReport)(cacheListener);
if (shouldGenerateJobSummary()) {
if (shouldGenerateJobSummary(buildResults)) {
core.info('Generating Job Summary');
core.summary.addRaw(summaryTable);
core.summary.addRaw(cachingReport);
Expand All @@ -137861,7 +137879,7 @@ function generateJobSummary(buildResults, cacheListener) {
core.info(cachingReport);
core.info('============================');
}
if (shouldAddPRComment()) {
if (shouldAddPRComment(buildResults)) {
yield addPRComment(summaryTable);
}
});
Expand Down Expand Up @@ -137933,14 +137951,27 @@ function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`;
}
function shouldGenerateJobSummary() {
function shouldGenerateJobSummary(buildResults) {
if (!process.env[summary_1.SUMMARY_ENV_VAR]) {
return false;
}
return params.isJobSummaryEnabled();
if (!params.isJobSummaryEnabled()) {
return false;
}
return shouldAddJobSummary(params.getJobSummaryOption(), buildResults);
}
function shouldAddPRComment() {
return params.isPRCommentEnabled();
function shouldAddPRComment(buildResults) {
return shouldAddJobSummary(params.getPRCommentOption(), buildResults);
}
function shouldAddJobSummary(option, buildResults) {
switch (option) {
case params.JobSummaryOption.Always:
return true;
case params.JobSummaryOption.Never:
return false;
case params.JobSummaryOption.OnFailure:
return buildResults.find(result => result.buildFailed) !== undefined;
}
}


Expand Down
2 changes: 1 addition & 1 deletion dist/post/index.js.map

Large diffs are not rendered by default.

0 comments on commit b19d228

Please sign in to comment.