mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-11-25 18:42:09 +00:00
Avoid appending to existing build-results file
When configuration-cache is enabled, the invocationId may not be unique, which can result in mulitple builds writing to the same file. Rather than failing the post-action, we simply ignore any subsequent build results with the same ID. Fixes #441
This commit is contained in:
parent
c295a4096e
commit
394498f89f
1 changed files with 3 additions and 1 deletions
|
@ -54,6 +54,8 @@ abstract class BuildResultsRecorder implements BuildService<BuildResultsRecorder
|
|||
def buildResultsDir = new File(runnerTempDir, ".build-results")
|
||||
buildResultsDir.mkdirs()
|
||||
def buildResultsFile = new File(buildResultsDir, githubActionStep + getParameters().getInvocationId().get() + ".json")
|
||||
buildResultsFile << groovy.json.JsonOutput.toJson(buildResults)
|
||||
if (!buildResultsFile.exists()) {
|
||||
buildResultsFile << groovy.json.JsonOutput.toJson(buildResults)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue