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 b47066d commit be46629
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 4 deletions.
35 changes: 34 additions & 1 deletion 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.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.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;
const core = __importStar(__nccwpck_require__(42186));
const string_argv_1 = __nccwpck_require__(19663);
function isCacheDisabled() {
Expand Down Expand Up @@ -140414,6 +140414,10 @@ function isJobSummaryEnabled() {
return getBooleanInput('generate-job-summary', true);
}
exports.isJobSummaryEnabled = isJobSummaryEnabled;
function isPRCommentEnabled() {
return getBooleanInput('add-pr-comment', false);
}
exports.isPRCommentEnabled = isPRCommentEnabled;
function isDependencyGraphEnabled() {
return getBooleanInput('generate-dependency-graph', true);
}
Expand Down Expand Up @@ -140515,6 +140519,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.generateJobSummary = void 0;
const core = __importStar(__nccwpck_require__(42186));
const github = __importStar(__nccwpck_require__(95438));
const summary_1 = __nccwpck_require__(81327);
const params = __importStar(__nccwpck_require__(23885));
const cache_reporting_1 = __nccwpck_require__(66674);
Expand All @@ -140523,6 +140528,7 @@ function generateJobSummary(buildResults, cacheListener) {
const summaryTable = renderSummaryTable(buildResults);
const cachingReport = (0, cache_reporting_1.generateCachingReport)(cacheListener);
if (shouldGenerateJobSummary()) {
core.info('Generating Job Summary');
core.summary.addRaw(summaryTable);
core.summary.addRaw(cachingReport);
yield core.summary.write();
Expand All @@ -140534,9 +140540,33 @@ function generateJobSummary(buildResults, cacheListener) {
core.info(cachingReport);
core.info('============================');
}
if (shouldAddPRComment()) {
yield addPRComment(summaryTable);
}
});
}
exports.generateJobSummary = generateJobSummary;
function addPRComment(content) {
return __awaiter(this, void 0, void 0, function* () {
try {
const github_token = params.getGithubToken();
const context = github.context;
if (context.payload.pull_request == null) {
core.info('Not a PR');
core.info(`Issue number: ${context.issue.number}`);
core.info(`Context payload: ${JSON.stringify(context.payload)}`);
return;
}
const pull_request_number = context.payload.pull_request.number;
core.info(`Adding Job Summary as comment to PR #${pull_request_number}.`);
const octokit = github.getOctokit(github_token);
yield octokit.rest.issues.createComment(Object.assign(Object.assign({}, context.repo), { issue_number: pull_request_number, body: content }));
}
catch (error) {
core.warning(`Failed to generate PR comment: ${String(error)}`);
}
});
}
function renderSummaryTable(results) {
if (results.length === 0) {
return 'No Gradle build results detected.';
Expand Down Expand Up @@ -140587,6 +140617,9 @@ function shouldGenerateJobSummary() {
}
return params.isJobSummaryEnabled();
}
function shouldAddPRComment() {
return params.isPRCommentEnabled();
}


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

Large diffs are not rendered by default.

35 changes: 34 additions & 1 deletion 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.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.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;
const core = __importStar(__nccwpck_require__(42186));
const string_argv_1 = __nccwpck_require__(19663);
function isCacheDisabled() {
Expand Down Expand Up @@ -137735,6 +137735,10 @@ function isJobSummaryEnabled() {
return getBooleanInput('generate-job-summary', true);
}
exports.isJobSummaryEnabled = isJobSummaryEnabled;
function isPRCommentEnabled() {
return getBooleanInput('add-pr-comment', false);
}
exports.isPRCommentEnabled = isPRCommentEnabled;
function isDependencyGraphEnabled() {
return getBooleanInput('generate-dependency-graph', true);
}
Expand Down Expand Up @@ -137836,6 +137840,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.generateJobSummary = void 0;
const core = __importStar(__nccwpck_require__(42186));
const github = __importStar(__nccwpck_require__(95438));
const summary_1 = __nccwpck_require__(81327);
const params = __importStar(__nccwpck_require__(23885));
const cache_reporting_1 = __nccwpck_require__(66674);
Expand All @@ -137844,6 +137849,7 @@ function generateJobSummary(buildResults, cacheListener) {
const summaryTable = renderSummaryTable(buildResults);
const cachingReport = (0, cache_reporting_1.generateCachingReport)(cacheListener);
if (shouldGenerateJobSummary()) {
core.info('Generating Job Summary');
core.summary.addRaw(summaryTable);
core.summary.addRaw(cachingReport);
yield core.summary.write();
Expand All @@ -137855,9 +137861,33 @@ function generateJobSummary(buildResults, cacheListener) {
core.info(cachingReport);
core.info('============================');
}
if (shouldAddPRComment()) {
yield addPRComment(summaryTable);
}
});
}
exports.generateJobSummary = generateJobSummary;
function addPRComment(content) {
return __awaiter(this, void 0, void 0, function* () {
try {
const github_token = params.getGithubToken();
const context = github.context;
if (context.payload.pull_request == null) {
core.info('Not a PR');
core.info(`Issue number: ${context.issue.number}`);
core.info(`Context payload: ${JSON.stringify(context.payload)}`);
return;
}
const pull_request_number = context.payload.pull_request.number;
core.info(`Adding Job Summary as comment to PR #${pull_request_number}.`);
const octokit = github.getOctokit(github_token);
yield octokit.rest.issues.createComment(Object.assign(Object.assign({}, context.repo), { issue_number: pull_request_number, body: content }));
}
catch (error) {
core.warning(`Failed to generate PR comment: ${String(error)}`);
}
});
}
function renderSummaryTable(results) {
if (results.length === 0) {
return 'No Gradle build results detected.';
Expand Down Expand Up @@ -137908,6 +137938,9 @@ function shouldGenerateJobSummary() {
}
return params.isJobSummaryEnabled();
}
function shouldAddPRComment() {
return params.isPRCommentEnabled();
}


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

Large diffs are not rendered by default.

0 comments on commit be46629

Please sign in to comment.