mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-12-25 01:26:19 +08:00
Improve build badgee for builds without scan links
This commit is contained in:
parent
5203a0b09d
commit
6001bc9edc
@ -60,13 +60,10 @@ function writeSummaryTable(results: BuildResult[]): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderOutcome(result: BuildResult): string {
|
function renderOutcome(result: BuildResult): string {
|
||||||
const badgeUrl = result.buildFailed
|
const labelPart = result.buildScanUri ? 'Build%20Scan%E2%84%A2' : 'Build'
|
||||||
? 'https://img.shields.io/badge/Build%20Scan%E2%84%A2-FAILED-red?logo=Gradle'
|
const outcomePart = result.buildFailed ? 'FAILED-red' : 'SUCCESS-brightgreen'
|
||||||
: 'https://img.shields.io/badge/Build%20Scan%E2%84%A2-SUCCESS-brightgreen?logo=Gradle'
|
const badgeUrl = `https://img.shields.io/badge/${labelPart}-${outcomePart}?logo=Gradle`
|
||||||
const badgeHtml = `<img src="${badgeUrl}" alt="Gradle Build">`
|
const badgeHtml = `<img src="${badgeUrl}" alt="Gradle Build">`
|
||||||
|
const targetUrl = result.buildScanUri ? result.buildScanUri : '#'
|
||||||
if (result.buildScanUri) {
|
return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`
|
||||||
return `<a href="${result.buildScanUri}" rel="nofollow">${badgeHtml}</a>`
|
|
||||||
}
|
|
||||||
return badgeHtml
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user