Skip to content

Commit 0d870fd

Browse files
lindseywildCopilot
andcommitted
Use unique filenames for output files to avoid collisions
When an action is invoked multiple times in the same job, a fixed filename would cause later invocations to overwrite earlier outputs. Use crypto.randomUUID() to generate unique filenames. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c056abf commit 0d870fd

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

.github/actions/file/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export default async function () {
135135
}
136136
}
137137

138-
const filingsPath = path.join(process.env.RUNNER_TEMP || '/tmp', 'filings.json')
138+
const filingsPath = path.join(process.env.RUNNER_TEMP || '/tmp', `filings-${crypto.randomUUID()}.json`)
139139
fs.writeFileSync(filingsPath, JSON.stringify(filings))
140140
core.setOutput('filings_file', filingsPath)
141141

.github/actions/find/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default async function () {
4646
core.info(`Found ${findingsForUrl.length} findings for ${url}`)
4747
}
4848

49-
const findingsPath = path.join(process.env.RUNNER_TEMP || '/tmp', 'findings.json')
49+
const findingsPath = path.join(process.env.RUNNER_TEMP || '/tmp', `findings-${crypto.randomUUID()}.json`)
5050
fs.writeFileSync(findingsPath, JSON.stringify(findings))
5151
core.setOutput('findings_file', findingsPath)
5252

.github/actions/fix/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default async function () {
5959
}
6060
}
6161

62-
const fixingsPath = path.join(process.env.RUNNER_TEMP || '/tmp', 'fixings.json')
62+
const fixingsPath = path.join(process.env.RUNNER_TEMP || '/tmp', `fixings-${crypto.randomUUID()}.json`)
6363
fs.writeFileSync(fixingsPath, JSON.stringify(fixings))
6464
core.setOutput('fixings_file', fixingsPath)
6565

0 commit comments

Comments
 (0)