mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-11-29 11:40:59 -05:00
Prevent duplicate JSON being written to build-results
This commit is contained in:
parent
a4a9a30e86
commit
0b5047ec4d
2 changed files with 6 additions and 2 deletions
|
@ -95,8 +95,11 @@ def captureUsingBuildFinished(gradle, invocationId) {
|
|||
def buildResultsDir = new File(System.getenv("RUNNER_TEMP"), ".build-results")
|
||||
buildResultsDir.mkdirs()
|
||||
def buildResultsFile = new File(buildResultsDir, System.getenv("GITHUB_ACTION") + invocationId + ".json")
|
||||
// Don't overwrite file generated by build-scan plugin if present (which has build-scan-uri)
|
||||
if (!buildResultsFile.exists()) {
|
||||
buildResultsFile << groovy.json.JsonOutput.toJson(buildResults)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def captureUsingBuildService(settings, invocationId) {
|
||||
|
|
|
@ -135,6 +135,7 @@ class TestBuildResultRecorder extends BaseInitScriptTest {
|
|||
assert buildResultsDir.listFiles().size() == 1
|
||||
def resultsFile = buildResultsDir.listFiles()[0]
|
||||
assert resultsFile.name.startsWith('github-step-id')
|
||||
assert resultsFile.text.count('rootProjectName') == 1
|
||||
return resultsFile
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue