mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-12-27 01:02:11 -05:00
Build outputs
This commit is contained in:
parent
67f42d16a1
commit
ce3874fec9
4 changed files with 72 additions and 42 deletions
55
dist/main/index.js
vendored
55
dist/main/index.js
vendored
|
@ -66034,28 +66034,43 @@ function loadBuildResults() {
|
||||||
exports.loadBuildResults = loadBuildResults;
|
exports.loadBuildResults = loadBuildResults;
|
||||||
function writeSummaryTable(results) {
|
function writeSummaryTable(results) {
|
||||||
core.summary.addHeading('Gradle Builds', 3);
|
core.summary.addHeading('Gradle Builds', 3);
|
||||||
core.summary.addTable([
|
core.summary.addRaw(`
|
||||||
[
|
<table>
|
||||||
{ data: 'Root Project', header: true },
|
<tr>
|
||||||
{ data: 'Tasks', header: true },
|
<th>Root Project</th>
|
||||||
{ data: 'Gradle Version', header: true },
|
<th>Requested Tasks</th>
|
||||||
{ data: 'Outcome', header: true }
|
<th>Gradle Version</th>
|
||||||
],
|
<th>Build Outcome</th>
|
||||||
...results.map(result => [
|
<th>Build Scan™</th>
|
||||||
result.rootProjectName,
|
</tr>${results.map(result => renderBuildResultRow(result)).join('')}
|
||||||
result.requestedTasks,
|
</table>
|
||||||
result.gradleVersion,
|
`);
|
||||||
renderOutcome(result)
|
}
|
||||||
])
|
function renderBuildResultRow(result) {
|
||||||
]);
|
return `
|
||||||
core.summary.addRaw('\n');
|
<tr>
|
||||||
|
<td>${result.rootProjectName}</td>
|
||||||
|
<td>${result.requestedTasks}</td>
|
||||||
|
<td align='center'>${result.gradleVersion}</td>
|
||||||
|
<td align='center'>${renderOutcome(result)}</td>
|
||||||
|
<td>${renderBuildScan(result)}</td>
|
||||||
|
</tr>`;
|
||||||
}
|
}
|
||||||
function renderOutcome(result) {
|
function renderOutcome(result) {
|
||||||
const labelPart = result.buildScanUri ? 'Build%20Scan%E2%84%A2' : 'Build';
|
return result.buildFailed ? ':x:' : ':white_check_mark:';
|
||||||
const outcomePart = result.buildFailed ? 'FAILED-red' : 'SUCCESS-brightgreen';
|
}
|
||||||
const badgeUrl = `https://img.shields.io/badge/${labelPart}-${outcomePart}?logo=Gradle`;
|
function renderBuildScan(result) {
|
||||||
const badgeHtml = `<img src="${badgeUrl}" alt="Gradle Build">`;
|
if (result.buildScanFailed) {
|
||||||
const targetUrl = result.buildScanUri ? result.buildScanUri : '#';
|
return renderBuildScanBadge('PUBLISH_FAILED', 'orange', 'https://docs.gradle.com/enterprise/gradle-plugin/#troubleshooting');
|
||||||
|
}
|
||||||
|
if (result.buildScanUri) {
|
||||||
|
return renderBuildScanBadge('PUBLISHED', '06A0CE', result.buildScanUri);
|
||||||
|
}
|
||||||
|
return renderBuildScanBadge('NOT_PUBLISHED', 'lightgrey', 'https://scans.gradle.com');
|
||||||
|
}
|
||||||
|
function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
|
||||||
|
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%E2%84%A2-${outcomeText}-${outcomeColor}?logo=Gradle`;
|
||||||
|
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
|
||||||
return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`;
|
return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
dist/main/index.js.map
vendored
2
dist/main/index.js.map
vendored
File diff suppressed because one or more lines are too long
55
dist/post/index.js
vendored
55
dist/post/index.js
vendored
|
@ -64954,28 +64954,43 @@ function loadBuildResults() {
|
||||||
exports.loadBuildResults = loadBuildResults;
|
exports.loadBuildResults = loadBuildResults;
|
||||||
function writeSummaryTable(results) {
|
function writeSummaryTable(results) {
|
||||||
core.summary.addHeading('Gradle Builds', 3);
|
core.summary.addHeading('Gradle Builds', 3);
|
||||||
core.summary.addTable([
|
core.summary.addRaw(`
|
||||||
[
|
<table>
|
||||||
{ data: 'Root Project', header: true },
|
<tr>
|
||||||
{ data: 'Tasks', header: true },
|
<th>Root Project</th>
|
||||||
{ data: 'Gradle Version', header: true },
|
<th>Requested Tasks</th>
|
||||||
{ data: 'Outcome', header: true }
|
<th>Gradle Version</th>
|
||||||
],
|
<th>Build Outcome</th>
|
||||||
...results.map(result => [
|
<th>Build Scan™</th>
|
||||||
result.rootProjectName,
|
</tr>${results.map(result => renderBuildResultRow(result)).join('')}
|
||||||
result.requestedTasks,
|
</table>
|
||||||
result.gradleVersion,
|
`);
|
||||||
renderOutcome(result)
|
}
|
||||||
])
|
function renderBuildResultRow(result) {
|
||||||
]);
|
return `
|
||||||
core.summary.addRaw('\n');
|
<tr>
|
||||||
|
<td>${result.rootProjectName}</td>
|
||||||
|
<td>${result.requestedTasks}</td>
|
||||||
|
<td align='center'>${result.gradleVersion}</td>
|
||||||
|
<td align='center'>${renderOutcome(result)}</td>
|
||||||
|
<td>${renderBuildScan(result)}</td>
|
||||||
|
</tr>`;
|
||||||
}
|
}
|
||||||
function renderOutcome(result) {
|
function renderOutcome(result) {
|
||||||
const labelPart = result.buildScanUri ? 'Build%20Scan%E2%84%A2' : 'Build';
|
return result.buildFailed ? ':x:' : ':white_check_mark:';
|
||||||
const outcomePart = result.buildFailed ? 'FAILED-red' : 'SUCCESS-brightgreen';
|
}
|
||||||
const badgeUrl = `https://img.shields.io/badge/${labelPart}-${outcomePart}?logo=Gradle`;
|
function renderBuildScan(result) {
|
||||||
const badgeHtml = `<img src="${badgeUrl}" alt="Gradle Build">`;
|
if (result.buildScanFailed) {
|
||||||
const targetUrl = result.buildScanUri ? result.buildScanUri : '#';
|
return renderBuildScanBadge('PUBLISH_FAILED', 'orange', 'https://docs.gradle.com/enterprise/gradle-plugin/#troubleshooting');
|
||||||
|
}
|
||||||
|
if (result.buildScanUri) {
|
||||||
|
return renderBuildScanBadge('PUBLISHED', '06A0CE', result.buildScanUri);
|
||||||
|
}
|
||||||
|
return renderBuildScanBadge('NOT_PUBLISHED', 'lightgrey', 'https://scans.gradle.com');
|
||||||
|
}
|
||||||
|
function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
|
||||||
|
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%E2%84%A2-${outcomeText}-${outcomeColor}?logo=Gradle`;
|
||||||
|
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
|
||||||
return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`;
|
return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
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
Loading…
Reference in a new issue