eric sciple 2025-10-17 00:32:56 +00:00
parent dc519229d3
commit 1929737c8e
2 changed files with 29 additions and 14 deletions

20
dist/index.js vendored
View File

@ -498,13 +498,21 @@ class GitAuthHelper {
} }
// Remove credentials config files // Remove credentials config files
for (const credentialsPath of credentialsPaths) { for (const credentialsPath of credentialsPaths) {
try { // Only remove credentials config files if they are under RUNNER_TEMP
core.info(`Removing credentials config '${credentialsPath}'`); const runnerTemp = process.env['RUNNER_TEMP'];
yield io.rmRF(credentialsPath); assert.ok(runnerTemp, 'RUNNER_TEMP is not defined');
if (credentialsPath.startsWith(runnerTemp)) {
try {
core.info(`Removing credentials config '${credentialsPath}'`);
yield io.rmRF(credentialsPath);
}
catch (err) {
core.debug(`${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : err}`);
core.warning(`Failed to remove credentials config '${credentialsPath}'`);
}
} }
catch (err) { else {
core.debug(`${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : err}`); core.debug(`Skipping removal of credentials config '${credentialsPath}' - not under RUNNER_TEMP`);
core.warning(`Failed to remove credentials config '${credentialsPath}'`);
} }
} }
}); });

View File

@ -473,14 +473,21 @@ class GitAuthHelper {
// Remove credentials config files // Remove credentials config files
for (const credentialsPath of credentialsPaths) { for (const credentialsPath of credentialsPaths) {
try { // Only remove credentials config files if they are under RUNNER_TEMP
core.info(`Removing credentials config '${credentialsPath}'`) const runnerTemp = process.env['RUNNER_TEMP']
await io.rmRF(credentialsPath) assert.ok(runnerTemp, 'RUNNER_TEMP is not defined')
} catch (err) { if (credentialsPath.startsWith(runnerTemp)) {
core.debug(`${(err as any)?.message ?? err}`) try {
core.warning( core.info(`Removing credentials config '${credentialsPath}'`)
`Failed to remove credentials config '${credentialsPath}'` await io.rmRF(credentialsPath)
) } catch (err) {
core.debug(`${(err as any)?.message ?? err}`)
core.warning(
`Failed to remove credentials config '${credentialsPath}'`
)
}
} else {
core.debug(`Skipping removal of credentials config '${credentialsPath}' - not under RUNNER_TEMP`)
} }
} }
} }