Skip to content

Commit

Permalink
Merge pull request #38 from bakerkretzmar/delete-output
Browse files Browse the repository at this point in the history
Set `site-id` output on preview deletion
  • Loading branch information
bakerkretzmar authored May 17, 2024
2 parents c5700a3 + fba13af commit 2313551
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,6 @@ export async function destroyPreview({
core.info('Deleting database.');
await site.deleteDatabase(normalizeDatabaseName(branch));
}

return { id: site.id };
}
6 changes: 5 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,15 @@ export async function run() {
});
}
} else if (pr.action === 'closed') {
await destroyPreview({
const preview = await destroyPreview({
branch: pr.pull_request.head.ref,
servers,
environment,
});

if (preview) {
core.setOutput('site-id', preview.id);
}
}
} catch (error) {
if (error instanceof ForgeError) {
Expand Down

0 comments on commit 2313551

Please sign in to comment.