mirror of
				https://github.com/gradle/gradle-build-action.git
				synced 2025-11-04 09:58:56 +08:00 
			
		
		
		
	Build outputs
This commit is contained in:
		
							
								
								
									
										215
									
								
								dist/post/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										215
									
								
								dist/post/index.js
									
									
									
									
										vendored
									
									
								
							@@ -136737,8 +136737,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
 | 
			
		||||
exports.logCachingReport = exports.writeCachingReport = exports.CacheEntryListener = exports.CacheListener = void 0;
 | 
			
		||||
const core = __importStar(__nccwpck_require__(42186));
 | 
			
		||||
exports.generateCachingReport = exports.CacheEntryListener = exports.CacheListener = void 0;
 | 
			
		||||
const cache = __importStar(__nccwpck_require__(27799));
 | 
			
		||||
class CacheListener {
 | 
			
		||||
    constructor() {
 | 
			
		||||
@@ -136826,37 +136825,36 @@ class CacheEntryListener {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
exports.CacheEntryListener = CacheEntryListener;
 | 
			
		||||
function writeCachingReport(listener) {
 | 
			
		||||
function generateCachingReport(listener) {
 | 
			
		||||
    const entries = listener.cacheEntries;
 | 
			
		||||
    core.summary.addRaw(`\n<details><summary><h4>Caching for gradle-build-action was ${listener.cacheStatus} - expand for details</h4></summary>\n`);
 | 
			
		||||
    core.summary.addTable([
 | 
			
		||||
        [
 | 
			
		||||
            { data: '', header: true },
 | 
			
		||||
            { data: 'Count', header: true },
 | 
			
		||||
            { data: 'Total Size (Mb)', header: true }
 | 
			
		||||
        ],
 | 
			
		||||
        ['Entries Restored', `${getCount(entries, e => e.restoredSize)}`, `${getSize(entries, e => e.restoredSize)}`],
 | 
			
		||||
        ['Entries Saved', `${getCount(entries, e => e.savedSize)}`, `${getSize(entries, e => e.savedSize)}`]
 | 
			
		||||
    ]);
 | 
			
		||||
    core.summary.addHeading('Cache Entry Details', 5);
 | 
			
		||||
    const entryDetails = renderEntryDetails(listener);
 | 
			
		||||
    core.summary.addRaw(`<pre>
 | 
			
		||||
${entryDetails}
 | 
			
		||||
    return `
 | 
			
		||||
<details>
 | 
			
		||||
<summary><h4>Caching for gradle-build-action was ${listener.cacheStatus} - expand for details</h4></summary>
 | 
			
		||||
${renderEntryTable(entries)}
 | 
			
		||||
 | 
			
		||||
<h5>Cache Entry Details</h5>
 | 
			
		||||
<pre>
 | 
			
		||||
    ${renderEntryDetails(listener)}
 | 
			
		||||
</pre>
 | 
			
		||||
</details>
 | 
			
		||||
`);
 | 
			
		||||
    `;
 | 
			
		||||
}
 | 
			
		||||
exports.writeCachingReport = writeCachingReport;
 | 
			
		||||
function logCachingReport(listener) {
 | 
			
		||||
    const entries = listener.cacheEntries;
 | 
			
		||||
    core.startGroup(`Caching for gradle-build-action was ${listener.cacheStatus} - expand for details`);
 | 
			
		||||
    core.info(`Entries Restored: ${getCount(entries, e => e.restoredSize)} (${getSize(entries, e => e.restoredSize)} Mb)`);
 | 
			
		||||
    core.info(`Entries Saved   : ${getCount(entries, e => e.savedSize)} (${getSize(entries, e => e.savedSize)} Mb)`);
 | 
			
		||||
    core.info(`Cache Entry Details`);
 | 
			
		||||
    core.info(renderEntryDetails(listener));
 | 
			
		||||
    core.endGroup();
 | 
			
		||||
exports.generateCachingReport = generateCachingReport;
 | 
			
		||||
function renderEntryTable(entries) {
 | 
			
		||||
    return `
 | 
			
		||||
<table>
 | 
			
		||||
    <tr><td></td><th>Count</th><th>Total Size (Mb)</th></tr>
 | 
			
		||||
    <tr><td>Entries Restored</td>
 | 
			
		||||
        <td>${getCount(entries, e => e.restoredSize)}</td>
 | 
			
		||||
        <td>${getSize(entries, e => e.restoredSize)}</td>
 | 
			
		||||
    </tr>
 | 
			
		||||
    <tr><td>Entries Saved</td>
 | 
			
		||||
        <td>${getCount(entries, e => e.savedSize)}</td>
 | 
			
		||||
        <td>${getSize(entries, e => e.savedSize)}</td>
 | 
			
		||||
    </tr>
 | 
			
		||||
</table>
 | 
			
		||||
    `;
 | 
			
		||||
}
 | 
			
		||||
exports.logCachingReport = logCachingReport;
 | 
			
		||||
function renderEntryDetails(listener) {
 | 
			
		||||
    return listener.cacheEntries
 | 
			
		||||
        .map(entry => {
 | 
			
		||||
@@ -137665,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.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() {
 | 
			
		||||
@@ -137737,10 +137735,26 @@ function isJobSummaryEnabled() {
 | 
			
		||||
    return getBooleanInput('generate-job-summary', true);
 | 
			
		||||
}
 | 
			
		||||
exports.isJobSummaryEnabled = isJobSummaryEnabled;
 | 
			
		||||
function isDependencyGraphEnabled() {
 | 
			
		||||
    return getBooleanInput('generate-dependency-graph', true);
 | 
			
		||||
function getJobSummaryOption() {
 | 
			
		||||
    return parseJobSummaryOption('add-job-summary');
 | 
			
		||||
}
 | 
			
		||||
exports.getJobSummaryOption = getJobSummaryOption;
 | 
			
		||||
function getPRCommentOption() {
 | 
			
		||||
    return parseJobSummaryOption('add-job-summary-as-pr-comment');
 | 
			
		||||
}
 | 
			
		||||
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()) {
 | 
			
		||||
@@ -137755,7 +137769,7 @@ function getDependencyGraphOption() {
 | 
			
		||||
        case 'download-and-submit':
 | 
			
		||||
            return DependencyGraphOption.DownloadAndSubmit;
 | 
			
		||||
    }
 | 
			
		||||
    throw TypeError(`The value '${val} is not valid for 'dependency-graph. Valid values are: [disabled, generate, generate-and-submit, generate-and-upload, download-and-submit]. The default value is 'disabled'.`);
 | 
			
		||||
    throw TypeError(`The value '${val}' is not valid for 'dependency-graph'. Valid values are: [disabled, generate, generate-and-submit, generate-and-upload, download-and-submit]. The default value is 'disabled'.`);
 | 
			
		||||
}
 | 
			
		||||
exports.getDependencyGraphOption = getDependencyGraphOption;
 | 
			
		||||
function getArtifactRetentionDays() {
 | 
			
		||||
@@ -137794,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 = {}));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/***/ }),
 | 
			
		||||
@@ -137836,48 +137856,89 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
 | 
			
		||||
exports.logJobSummary = exports.writeJobSummary = void 0;
 | 
			
		||||
exports.generateJobSummary = void 0;
 | 
			
		||||
const core = __importStar(__nccwpck_require__(42186));
 | 
			
		||||
const github = __importStar(__nccwpck_require__(95438));
 | 
			
		||||
const summary_1 = __nccwpck_require__(81327);
 | 
			
		||||
const request_error_1 = __nccwpck_require__(10537);
 | 
			
		||||
const params = __importStar(__nccwpck_require__(23885));
 | 
			
		||||
const cache_reporting_1 = __nccwpck_require__(66674);
 | 
			
		||||
function writeJobSummary(buildResults, cacheListener) {
 | 
			
		||||
function generateJobSummary(buildResults, cacheListener) {
 | 
			
		||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
			
		||||
        core.info('Writing job summary');
 | 
			
		||||
        if (buildResults.length === 0) {
 | 
			
		||||
            core.debug('No Gradle build results found. Summary table will not be generated.');
 | 
			
		||||
        const summaryTable = renderSummaryTable(buildResults);
 | 
			
		||||
        const cachingReport = (0, cache_reporting_1.generateCachingReport)(cacheListener);
 | 
			
		||||
        if (shouldGenerateJobSummary(buildResults)) {
 | 
			
		||||
            core.info('Generating Job Summary');
 | 
			
		||||
            core.summary.addRaw(summaryTable);
 | 
			
		||||
            core.summary.addRaw(cachingReport);
 | 
			
		||||
            yield core.summary.write();
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            writeSummaryTable(buildResults);
 | 
			
		||||
            core.info('============================');
 | 
			
		||||
            core.info(summaryTable);
 | 
			
		||||
            core.info('============================');
 | 
			
		||||
            core.info(cachingReport);
 | 
			
		||||
            core.info('============================');
 | 
			
		||||
        }
 | 
			
		||||
        if (shouldAddPRComment(buildResults)) {
 | 
			
		||||
            yield addPRComment(summaryTable);
 | 
			
		||||
        }
 | 
			
		||||
        (0, cache_reporting_1.writeCachingReport)(cacheListener);
 | 
			
		||||
        yield core.summary.write();
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
exports.writeJobSummary = writeJobSummary;
 | 
			
		||||
function logJobSummary(buildResults, cacheListener) {
 | 
			
		||||
exports.generateJobSummary = generateJobSummary;
 | 
			
		||||
function addPRComment(jobSummary) {
 | 
			
		||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
			
		||||
        if (buildResults.length === 0) {
 | 
			
		||||
            core.debug('No Gradle build results found. Summary table will not be logged.');
 | 
			
		||||
        const context = github.context;
 | 
			
		||||
        if (context.payload.pull_request == null) {
 | 
			
		||||
            core.info('No pull_request trigger: not adding PR comment');
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            logSummaryTable(buildResults);
 | 
			
		||||
        const pull_request_number = context.payload.pull_request.number;
 | 
			
		||||
        core.info(`Adding Job Summary as comment to PR #${pull_request_number}.`);
 | 
			
		||||
        const prComment = `<h3>Job Summary for gradle-build-action</h3>
 | 
			
		||||
<h5>${github.context.workflow} :: <em>${github.context.job}</em></h5>
 | 
			
		||||
 | 
			
		||||
${jobSummary}`;
 | 
			
		||||
        const github_token = params.getGithubToken();
 | 
			
		||||
        const octokit = github.getOctokit(github_token);
 | 
			
		||||
        try {
 | 
			
		||||
            yield octokit.rest.issues.createComment(Object.assign(Object.assign({}, context.repo), { issue_number: pull_request_number, body: prComment }));
 | 
			
		||||
        }
 | 
			
		||||
        catch (error) {
 | 
			
		||||
            if (error instanceof request_error_1.RequestError) {
 | 
			
		||||
                core.warning(buildWarningMessage(error));
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                throw error;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        (0, cache_reporting_1.logCachingReport)(cacheListener);
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
exports.logJobSummary = logJobSummary;
 | 
			
		||||
function writeSummaryTable(results) {
 | 
			
		||||
    core.summary.addHeading('Gradle Builds', 3);
 | 
			
		||||
    core.summary.addRaw(`
 | 
			
		||||
function buildWarningMessage(error) {
 | 
			
		||||
    const mainWarning = `Failed to generate PR comment.\n${String(error)}`;
 | 
			
		||||
    if (error.message === 'Resource not accessible by integration') {
 | 
			
		||||
        return `${mainWarning}
 | 
			
		||||
Please ensure that the 'pull-requests: write' permission is available for the workflow job.
 | 
			
		||||
Note that this permission is never available for a workflow triggered from a repository fork.
 | 
			
		||||
        `;
 | 
			
		||||
    }
 | 
			
		||||
    return mainWarning;
 | 
			
		||||
}
 | 
			
		||||
function renderSummaryTable(results) {
 | 
			
		||||
    if (results.length === 0) {
 | 
			
		||||
        return 'No Gradle build results detected.';
 | 
			
		||||
    }
 | 
			
		||||
    return `
 | 
			
		||||
<table>
 | 
			
		||||
    <tr>
 | 
			
		||||
        <th>Root Project</th>
 | 
			
		||||
        <th>Gradle Root Project</th>
 | 
			
		||||
        <th>Requested Tasks</th>
 | 
			
		||||
        <th>Gradle Version</th>
 | 
			
		||||
        <th>Build Outcome</th>
 | 
			
		||||
        <th>Build Scan®</th>
 | 
			
		||||
    </tr>${results.map(result => renderBuildResultRow(result)).join('')}
 | 
			
		||||
</table>
 | 
			
		||||
    `);
 | 
			
		||||
    `;
 | 
			
		||||
}
 | 
			
		||||
function renderBuildResultRow(result) {
 | 
			
		||||
    return `
 | 
			
		||||
@@ -137906,16 +137967,28 @@ function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
 | 
			
		||||
    const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
 | 
			
		||||
    return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`;
 | 
			
		||||
}
 | 
			
		||||
function logSummaryTable(results) {
 | 
			
		||||
    core.info('============================');
 | 
			
		||||
    core.info('Gradle Builds');
 | 
			
		||||
    core.info('----------------------------');
 | 
			
		||||
    core.info('Root Project | Requested Tasks | Gradle Version | Build Outcome | Build Scan®');
 | 
			
		||||
    core.info('----------------------------');
 | 
			
		||||
    for (const result of results) {
 | 
			
		||||
        core.info(`${result.rootProjectName} | ${result.requestedTasks} | ${result.gradleVersion} | ${result.buildFailed ? 'FAILED' : 'SUCCESS'} | ${result.buildScanFailed ? 'Publish failed' : result.buildScanUri}`);
 | 
			
		||||
function shouldGenerateJobSummary(buildResults) {
 | 
			
		||||
    if (!process.env[summary_1.SUMMARY_ENV_VAR]) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    if (!params.isJobSummaryEnabled()) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    return shouldAddJobSummary(params.getJobSummaryOption(), buildResults);
 | 
			
		||||
}
 | 
			
		||||
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:
 | 
			
		||||
            core.info(`Got these build results: ${JSON.stringify(buildResults)}`);
 | 
			
		||||
            return buildResults.some(result => result.buildFailed);
 | 
			
		||||
    }
 | 
			
		||||
    core.info('============================');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -138075,14 +138148,13 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
 | 
			
		||||
exports.complete = exports.setup = void 0;
 | 
			
		||||
const core = __importStar(__nccwpck_require__(42186));
 | 
			
		||||
const exec = __importStar(__nccwpck_require__(71514));
 | 
			
		||||
const summary_1 = __nccwpck_require__(81327);
 | 
			
		||||
const path = __importStar(__nccwpck_require__(71017));
 | 
			
		||||
const os = __importStar(__nccwpck_require__(22037));
 | 
			
		||||
const caches = __importStar(__nccwpck_require__(23800));
 | 
			
		||||
const layout = __importStar(__nccwpck_require__(28182));
 | 
			
		||||
const params = __importStar(__nccwpck_require__(23885));
 | 
			
		||||
const dependencyGraph = __importStar(__nccwpck_require__(80));
 | 
			
		||||
const job_summary_1 = __nccwpck_require__(87345);
 | 
			
		||||
const jobSummary = __importStar(__nccwpck_require__(87345));
 | 
			
		||||
const build_results_1 = __nccwpck_require__(82107);
 | 
			
		||||
const cache_reporting_1 = __nccwpck_require__(66674);
 | 
			
		||||
const daemon_controller_1 = __nccwpck_require__(85146);
 | 
			
		||||
@@ -138118,12 +138190,7 @@ function complete() {
 | 
			
		||||
        const cacheListener = cache_reporting_1.CacheListener.rehydrate(core.getState(CACHE_LISTENER));
 | 
			
		||||
        const daemonController = new daemon_controller_1.DaemonController(buildResults);
 | 
			
		||||
        yield caches.save(gradleUserHome, cacheListener, daemonController);
 | 
			
		||||
        if (shouldGenerateJobSummary()) {
 | 
			
		||||
            yield (0, job_summary_1.writeJobSummary)(buildResults, cacheListener);
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            (0, job_summary_1.logJobSummary)(buildResults, cacheListener);
 | 
			
		||||
        }
 | 
			
		||||
        yield jobSummary.generateJobSummary(buildResults, cacheListener);
 | 
			
		||||
        yield dependencyGraph.complete(params.getDependencyGraphOption());
 | 
			
		||||
        core.info('Completed post-action step');
 | 
			
		||||
    });
 | 
			
		||||
@@ -138153,12 +138220,6 @@ function determineUserHome() {
 | 
			
		||||
        return userHome;
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
function shouldGenerateJobSummary() {
 | 
			
		||||
    if (!process.env[summary_1.SUMMARY_ENV_VAR]) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    return params.isJobSummaryEnabled();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/***/ }),
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								dist/post/index.js.map
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/post/index.js.map
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Reference in New Issue
	
	Block a user