Skip to content

Commit

Permalink
DEVPROD-13059 Add confirmation prompt for deploys (#516)
Browse files Browse the repository at this point in the history
  • Loading branch information
khelif96 authored Nov 25, 2024
1 parent a0a5932 commit 2af55ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/deploy-utils/src/prepare-prod-deploy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,17 @@ export const prepareProdDeploy = async () => {

const version = getReleaseVersion(commitMessages);
console.log(`This deploy is a ${version} release.`);

const { value: shouldDeploy } = await prompts({
type: "confirm",
name: "value",
message: "Do you want to deploy?",
initial: true,
});
if (!shouldDeploy) {
console.log("Deploy cancelled.");
return;
}

createTagAndPush(version);
};
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ describe("prepareProdDeploy", () => {

it("creates tag with patch", async () => {
const consoleSpy = vi.spyOn(console, "log").mockImplementation(vi.fn());
vi.mocked(prompts).mockResolvedValueOnce({ value: true });
await prepareProdDeploy();
expect(vi.mocked(getCurrentlyDeployedCommit)).toHaveBeenCalledWith(
"spruce",
Expand Down

0 comments on commit 2af55ce

Please sign in to comment.