Write build scan link to GHA job summary

The new Job Summary functionality permits better rendering of build
results, including clickable build scan links
This commit is contained in:
Daz DeBoer 2022-05-24 14:11:39 +02:00
parent d63db6a05e
commit 646074d659
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: DD6B9F0B06683D5D

View file

@ -272,10 +272,12 @@ def registerCallbacks(buildScanExtension, rootProjectName) {
buildScanPublished { buildScan -> buildScanPublished { buildScan ->
// Send commands directly to GitHub Actions via STDOUT. // Send commands directly to GitHub Actions via STDOUT.
def gradleCommand = rootProjectName + " " + gradle.startParameter.taskNames.join(" ") def gradleCommand = rootProjectName + " " + gradle.startParameter.taskNames.join(" ")
def githubSummaryFile = new File(System.getenv("GITHUB_STEP_SUMMARY"))
if (buildFailed) { if (buildFailed) {
println("::warning ::Gradle build '\${gradleCommand}' FAILED - \${buildScan.buildScanUri}") githubSummaryFile << "❌ Gradle Build \`\${gradleCommand}\` [![Gradle Enterprise Build Scan](https://img.shields.io/badge/Gradle%20Enterprise%20Build%20Scan%E2%84%A2-FAILED-red?logo=Gradle)](\${buildScan.buildScanUri})"
} else { } else {
println("::notice ::Gradle build '\${gradleCommand}' - \${buildScan.buildScanUri}") githubSummaryFile << "✅ Gradle Build \`\${gradleCommand}\` [![Gradle Enterprise Build Scan](https://img.shields.io/badge/Gradle%20Enterprise%20Build%20Scan%E2%84%A2-SUCCESS-brightgreen?logo=Gradle)](\${buildScan.buildScanUri})"
} }
println("::set-output name=build-scan-url::\${buildScan.buildScanUri}") println("::set-output name=build-scan-url::\${buildScan.buildScanUri}")
} }