Skip to content

Commit

Permalink
Skip init-post cleanup on GitHub-hosted runners
Browse files Browse the repository at this point in the history
  • Loading branch information
henrymercer committed Jun 12, 2024
1 parent d8d73c0 commit ed34eb9
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 21 deletions.
26 changes: 16 additions & 10 deletions lib/init-action-post-helper.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/init-action-post-helper.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 19 additions & 10 deletions src/init-action-post-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,25 @@ export async function run(
await printDebugLogs(config);
}

try {
fs.rmSync(config.dbLocation, {
recursive: true,
force: true,
maxRetries: 3,
});
logger.info(`Cleaned up database cluster directory ${config.dbLocation}.`);
} catch (e) {
logger.warning(
`Failed to clean up database cluster directory ${config.dbLocation}. Details: ${e}`,
if (actionsUtil.isSelfHostedRunner()) {
try {
fs.rmSync(config.dbLocation, {
recursive: true,
force: true,
maxRetries: 3,
});
logger.info(
`Cleaned up database cluster directory ${config.dbLocation}.`,
);
} catch (e) {
logger.warning(
`Failed to clean up database cluster directory ${config.dbLocation}. Details: ${e}`,
);
}
} else {
logger.debug(
"Skipping cleanup of database cluster directory since we are running on a GitHub-hosted " +
"runner which will be automatically cleaned up.",
);
}

Expand Down

0 comments on commit ed34eb9

Please sign in to comment.