mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-12-24 11:36:18 +08:00
Remove unclickable buildScan link from failure
Build scan links will be rendered in GHA Job Summary.
This commit is contained in:
parent
dc49976071
commit
d63db6a05e
@ -264,16 +264,12 @@ if (isTopLevelBuild) {
|
||||
|
||||
def registerCallbacks(buildScanExtension, rootProjectName) {
|
||||
buildScanExtension.with {
|
||||
def scanFile = new File("gradle-build-scan.txt")
|
||||
def buildFailed = false
|
||||
|
||||
buildFinished { result ->
|
||||
buildFailed = (result.failure != null)
|
||||
}
|
||||
|
||||
buildScanPublished { buildScan ->
|
||||
scanFile.text = buildScan.buildScanUri
|
||||
|
||||
// Send commands directly to GitHub Actions via STDOUT.
|
||||
def gradleCommand = rootProjectName + " " + gradle.startParameter.taskNames.join(" ")
|
||||
if (buildFailed) {
|
||||
|
@ -1,17 +1,9 @@
|
||||
import * as core from '@actions/core'
|
||||
import * as exec from '@actions/exec'
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import * as gradlew from './gradlew'
|
||||
|
||||
export async function executeGradleBuild(executable: string | undefined, root: string, args: string[]): Promise<void> {
|
||||
let buildScanUrl: string | undefined
|
||||
|
||||
const buildScanFile = path.resolve(root, 'gradle-build-scan.txt')
|
||||
if (fs.existsSync(buildScanFile)) {
|
||||
fs.unlinkSync(buildScanFile)
|
||||
}
|
||||
|
||||
// Use the provided executable, or look for a Gradle wrapper script to run
|
||||
const toExecute = executable ?? gradlew.locateGradleWrapperScript(root)
|
||||
verifyIsExecutableScript(toExecute)
|
||||
@ -20,16 +12,8 @@ export async function executeGradleBuild(executable: string | undefined, root: s
|
||||
ignoreReturnCode: true
|
||||
})
|
||||
|
||||
if (fs.existsSync(buildScanFile)) {
|
||||
buildScanUrl = fs.readFileSync(buildScanFile, 'utf-8')
|
||||
}
|
||||
|
||||
if (status !== 0) {
|
||||
if (buildScanUrl) {
|
||||
core.setFailed(`Gradle build failed: ${buildScanUrl}`)
|
||||
} else {
|
||||
core.setFailed(`Gradle build failed: process exited with status ${status}`)
|
||||
}
|
||||
core.setFailed(`Gradle build failed: see console output for details`)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user