mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-12-25 14:46:18 +08: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
@ -54,6 +54,8 @@ abstract class BuildResultsRecorder implements BuildService<BuildResultsRecorder
|
|||||||
def buildResultsDir = new File(runnerTempDir, ".build-results")
|
def buildResultsDir = new File(runnerTempDir, ".build-results")
|
||||||
buildResultsDir.mkdirs()
|
buildResultsDir.mkdirs()
|
||||||
def buildResultsFile = new File(buildResultsDir, githubActionStep + getParameters().getInvocationId().get() + ".json")
|
def buildResultsFile = new File(buildResultsDir, githubActionStep + getParameters().getInvocationId().get() + ".json")
|
||||||
|
if (!buildResultsFile.exists()) {
|
||||||
buildResultsFile << groovy.json.JsonOutput.toJson(buildResults)
|
buildResultsFile << groovy.json.JsonOutput.toJson(buildResults)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user