Do not fail diff informed analyses when analyze is run twice in the same job

This commit is contained in:
Henry Mercer 2025-05-01 12:00:46 +01:00
parent 018ac1a585
commit 083772aae4
3 changed files with 14 additions and 3 deletions

View file

@ -498,7 +498,13 @@ function writeDiffRangeDataExtensionPack(
actionsUtil.getTemporaryDirectory(),
"pr-diff-range",
);
fs.mkdirSync(diffRangeDir);
// We expect the Actions temporary directory to already exist, so are mainly
// using `recursive: true` to avoid errors if the directory already exists,
// for example if the analyze Action is run multiple times in the same job.
// This is not really something that is supported, but we make use of it in
// tests.
fs.mkdirSync(diffRangeDir, { recursive: true });
fs.writeFileSync(
path.join(diffRangeDir, "qlpack.yml"),
`