mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-11-23 01:22:50 +00:00
Record build scan url directly from init script
Instead of writing the URL to a file on disk, reading it later and using the Actions API to record the output parameter and write the notice, these things are now done directly via Actions commands emitted directly from the init script.
This commit is contained in:
parent
45ef022607
commit
76f85a724c
2 changed files with 3 additions and 8 deletions
|
@ -299,6 +299,9 @@ def registerCallbacks(buildScanExtension, rootProjectName) {
|
||||||
def scanFile = new File("gradle-build-scan.txt")
|
def scanFile = new File("gradle-build-scan.txt")
|
||||||
buildScanPublished { buildScan ->
|
buildScanPublished { buildScan ->
|
||||||
scanFile.text = buildScan.buildScanUri
|
scanFile.text = buildScan.buildScanUri
|
||||||
|
|
||||||
|
println('::notice title=build-scan-url::' + buildScan.buildScanUri)
|
||||||
|
println('::set-output name=build-scan-url::' + buildScan.buildScanUri)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,20 +23,12 @@ export async function run(): Promise<void> {
|
||||||
args
|
args
|
||||||
)
|
)
|
||||||
|
|
||||||
if (result.buildScanUrl) {
|
|
||||||
core.setOutput('build-scan-url', result.buildScanUrl)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.status !== 0) {
|
if (result.status !== 0) {
|
||||||
if (result.buildScanUrl) {
|
if (result.buildScanUrl) {
|
||||||
core.setFailed(`Gradle build failed: ${result.buildScanUrl}`)
|
core.setFailed(`Gradle build failed: ${result.buildScanUrl}`)
|
||||||
} else {
|
} else {
|
||||||
core.setFailed(`Gradle build failed: process exited with status ${result.status}`)
|
core.setFailed(`Gradle build failed: process exited with status ${result.status}`)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (result.buildScanUrl) {
|
|
||||||
core.notice(`Gradle build succeeded: ${result.buildScanUrl}`)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(String(error))
|
core.setFailed(String(error))
|
||||||
|
|
Loading…
Reference in a new issue