mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-11-22 17:12:51 +00:00
Make build-scan notice a WARNING for failed builds
This commit is contained in:
parent
c349fa5b1f
commit
f75a3e8436
1 changed files with 7 additions and 4 deletions
|
@ -266,11 +266,11 @@ if (isTopLevelBuild) {
|
||||||
|
|
||||||
def registerCallbacks(buildScanExtension, rootProjectName) {
|
def registerCallbacks(buildScanExtension, rootProjectName) {
|
||||||
buildScanExtension.with {
|
buildScanExtension.with {
|
||||||
def buildOutcome = ""
|
|
||||||
def scanFile = new File("gradle-build-scan.txt")
|
def scanFile = new File("gradle-build-scan.txt")
|
||||||
|
def buildFailed = false
|
||||||
|
|
||||||
buildFinished { result ->
|
buildFinished { result ->
|
||||||
buildOutcome = result.failure == null ? " succeeded" : " failed"
|
buildFailed = (result.failure != null)
|
||||||
}
|
}
|
||||||
|
|
||||||
buildScanPublished { buildScan ->
|
buildScanPublished { buildScan ->
|
||||||
|
@ -278,8 +278,11 @@ def registerCallbacks(buildScanExtension, rootProjectName) {
|
||||||
|
|
||||||
// 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 message = "Gradle build '\${gradleCommand}'\${buildOutcome} - \${buildScan.buildScanUri}"
|
if (buildFailed) {
|
||||||
println("::notice ::\${message}")
|
println("::warning ::Gradle build '\${gradleCommand}' FAILED - \${buildScan.buildScanUri}")
|
||||||
|
} else {
|
||||||
|
println("::notice ::Gradle build '\${gradleCommand}' - \${buildScan.buildScanUri}")
|
||||||
|
}
|
||||||
println("::set-output name=build-scan-url::\${buildScan.buildScanUri}")
|
println("::set-output name=build-scan-url::\${buildScan.buildScanUri}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue