mirror of
https://github.com/gradle/actions.git
synced 2025-11-26 17:09:10 +08:00
Add error to job summary
This commit is contained in:
@@ -4,13 +4,20 @@ import {RequestError} from '@octokit/request-error'
|
||||
|
||||
import {BuildResults, BuildResult} from './build-results'
|
||||
import {SummaryConfig, getActionId, getGithubToken} from './configuration'
|
||||
import {Deprecation, getDeprecations} from './deprecation-collector'
|
||||
import {Deprecation, getDeprecations, getErrors} from './deprecation-collector'
|
||||
|
||||
export async function generateJobSummary(
|
||||
buildResults: BuildResults,
|
||||
cachingReport: string,
|
||||
config: SummaryConfig
|
||||
): Promise<void> {
|
||||
const errors = renderErrors()
|
||||
if (errors) {
|
||||
core.summary.addRaw(errors)
|
||||
await core.summary.write()
|
||||
return
|
||||
}
|
||||
|
||||
const summaryTable = renderSummaryTable(buildResults.results)
|
||||
|
||||
const hasFailure = buildResults.anyFailed()
|
||||
@@ -82,6 +89,14 @@ export function renderSummaryTable(results: BuildResult[]): string {
|
||||
return `${renderDeprecations()}\n${renderBuildResults(results)}`
|
||||
}
|
||||
|
||||
function renderErrors(): string | undefined {
|
||||
const errors = getErrors()
|
||||
if (errors.length === 0) {
|
||||
return undefined
|
||||
}
|
||||
return errors.map(error => `<b>:x: ${error}</b>`).join('\n')
|
||||
}
|
||||
|
||||
function renderDeprecations(): string {
|
||||
const deprecations = getDeprecations()
|
||||
if (deprecations.length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user