Merge pull request #445 from gradle/dd/no-duplicate-build-results

Avoid appending to existing build-results file
This commit is contained in:
Daz DeBoer 2022-09-29 08:28:05 -06:00 committed by GitHub
commit fd32ae9081
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)
} }
}
} }