mirror of
https://github.com/gradle/actions.git
synced 2026-09-05 04:21:37 +00:00
Add action heading to Gradle job summary (#1058)
Job summaries from setup-gradle/dependency-submission had no top-level heading, so they read poorly when another action's summary content lands in the same job. Name the action explicitly so the block is attributable when summaries are stacked. --------- Co-authored-by: Claude Sonnet 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
889dc537cf
commit
eed01f09d3
@@ -15,8 +15,11 @@ export async function generateJobSummary(
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
core.startGroup('Generating Job Summary')
|
core.startGroup('Generating Job Summary')
|
||||||
|
|
||||||
|
const heading = renderActionHeading()
|
||||||
|
|
||||||
const errors = renderErrors()
|
const errors = renderErrors()
|
||||||
if (errors) {
|
if (errors) {
|
||||||
|
core.summary.addRaw(heading)
|
||||||
core.summary.addRaw(errors)
|
core.summary.addRaw(errors)
|
||||||
await core.summary.write()
|
await core.summary.write()
|
||||||
return
|
return
|
||||||
@@ -31,6 +34,7 @@ export async function generateJobSummary(
|
|||||||
core.info(cachingReport)
|
core.info(cachingReport)
|
||||||
|
|
||||||
if (config.shouldGenerateJobSummary(hasFailure)) {
|
if (config.shouldGenerateJobSummary(hasFailure)) {
|
||||||
|
core.summary.addRaw(heading)
|
||||||
core.summary.addRaw(summaryTable)
|
core.summary.addRaw(summaryTable)
|
||||||
core.summary.addRaw(cachingReport)
|
core.summary.addRaw(cachingReport)
|
||||||
await core.summary.write()
|
await core.summary.write()
|
||||||
@@ -57,8 +61,7 @@ async function addPRComment(jobSummary: string): Promise<void> {
|
|||||||
core.info(`Adding Job Summary as comment to PR #${pull_request_number}.`)
|
core.info(`Adding Job Summary as comment to PR #${pull_request_number}.`)
|
||||||
|
|
||||||
const prComment = `${jobMarker(context)}
|
const prComment = `${jobMarker(context)}
|
||||||
<h3>Job Summary for Gradle</h3>
|
${renderActionHeading()}<a href="${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}" target="_blank">
|
||||||
<a href="${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}" target="_blank">
|
|
||||||
<h5>${context.workflow} :: <em>${context.job}</em></h5>
|
<h5>${context.workflow} :: <em>${context.job}</em></h5>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
@@ -97,6 +100,12 @@ export function renderSummaryTable(results: BuildResult[]): string {
|
|||||||
return `${renderDeprecations()}\n${renderBuildResults(results)}`
|
return `${renderDeprecations()}\n${renderBuildResults(results)}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function renderActionHeading(): string {
|
||||||
|
const actionId = getActionId()
|
||||||
|
const caption = actionId ? ` <sub><em>captured by ${actionId}</em></sub>` : ''
|
||||||
|
return `<h3>Gradle Builds${caption}</h3>\n\n`
|
||||||
|
}
|
||||||
|
|
||||||
function renderErrors(): string | undefined {
|
function renderErrors(): string | undefined {
|
||||||
const errors = getErrors()
|
const errors = getErrors()
|
||||||
if (errors.length === 0) {
|
if (errors.length === 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user