@@ -3,6 +3,7 @@ import pc from "picocolors";
33import { execSync } from "node:child_process" ;
44import { readFileSync , writeFileSync } from "node:fs" ;
55import { join } from "node:path" ;
6+ import * as readline from "node:readline" ;
67
78const REPO_ROOT = join ( import . meta. dirname , ".." , ".." ) ;
89
@@ -55,6 +56,20 @@ function error(message: string): never {
5556 process . exit ( 1 ) ;
5657}
5758
59+ async function confirm ( message : string ) : Promise < boolean > {
60+ const rl = readline . createInterface ( {
61+ input : process . stdin ,
62+ output : process . stdout ,
63+ } ) ;
64+
65+ return new Promise ( ( resolve ) => {
66+ rl . question ( pc . yellow ( `? ${ message } (y/N) ` ) , ( answer ) => {
67+ rl . close ( ) ;
68+ resolve ( answer . toLowerCase ( ) === "y" || answer . toLowerCase ( ) === "yes" ) ;
69+ } ) ;
70+ } ) ;
71+ }
72+
5873async function pollUntil (
5974 check : ( ) => boolean | Promise < boolean > ,
6075 options : {
@@ -226,6 +241,16 @@ function createAndPushPR(version: string): string {
226241async function waitForChecksAndMerge ( prUrl : string ) : Promise < void > {
227242 const prNumber = prUrl . split ( "/" ) . pop ( ) ;
228243
244+ console . log ( ) ;
245+ console . log ( pc . bold ( "Please review the pull request before proceeding:" ) ) ;
246+ console . log ( pc . cyan ( ` ${ prUrl } ` ) ) ;
247+ console . log ( ) ;
248+
249+ const confirmed = await confirm ( "Enable auto-merge and continue with the release?" ) ;
250+ if ( ! confirmed ) {
251+ error ( "Release cancelled by user" ) ;
252+ }
253+
229254 logStarted ( "Enabling auto-merge..." ) ;
230255 exec ( `gh pr merge ${ prNumber } --rebase --auto --delete-branch` ) ;
231256 logCompleted ( "Auto-merge enabled" ) ;
0 commit comments