Skip to content

Commit ed34eb9

Browse files
committed
Skip init-post cleanup on GitHub-hosted runners
1 parent d8d73c0 commit ed34eb9

File tree

3 files changed

+36
-21
lines changed

3 files changed

+36
-21
lines changed

Diff for: lib/init-action-post-helper.js

+16-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/init-action-post-helper.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/init-action-post-helper.ts

+19-10
Original file line numberDiff line numberDiff line change
@@ -219,16 +219,25 @@ export async function run(
219219
await printDebugLogs(config);
220220
}
221221

222-
try {
223-
fs.rmSync(config.dbLocation, {
224-
recursive: true,
225-
force: true,
226-
maxRetries: 3,
227-
});
228-
logger.info(`Cleaned up database cluster directory ${config.dbLocation}.`);
229-
} catch (e) {
230-
logger.warning(
231-
`Failed to clean up database cluster directory ${config.dbLocation}. Details: ${e}`,
222+
if (actionsUtil.isSelfHostedRunner()) {
223+
try {
224+
fs.rmSync(config.dbLocation, {
225+
recursive: true,
226+
force: true,
227+
maxRetries: 3,
228+
});
229+
logger.info(
230+
`Cleaned up database cluster directory ${config.dbLocation}.`,
231+
);
232+
} catch (e) {
233+
logger.warning(
234+
`Failed to clean up database cluster directory ${config.dbLocation}. Details: ${e}`,
235+
);
236+
}
237+
} else {
238+
logger.debug(
239+
"Skipping cleanup of database cluster directory since we are running on a GitHub-hosted " +
240+
"runner which will be automatically cleaned up.",
232241
);
233242
}
234243

0 commit comments

Comments
 (0)