Skip to content

Commit a722427

Browse files
committed
feat(pdk): add --skip-confirm parameter for automated releases
Add skipConfirm option to release command that skips all confirmation prompts including release confirmation, package selection, and tag pushing. This enables fully automated CI/CD workflows when combined with --release-version and --release-tag parameters.
1 parent c31dd76 commit a722427

3 files changed

Lines changed: 38 additions & 17 deletions

File tree

infra/pdk/src/cli.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ export function bootstrapCli() {
122122
'--release-tag <tag>',
123123
'Directly specify release tag (skips interactive selection)',
124124
)
125+
.option(
126+
'--skip-confirm',
127+
'Skip confirmation prompts during release',
128+
)
125129
.alias('release')
126130
.action((opts) => {
127131
// Process filter options

infra/pdk/src/commands/release.ts

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export async function release(options: ReleaseOptions = {}): Promise<void> {
5959
autoCreateReleaseBranch = false,
6060
releaseVersion,
6161
releaseTag,
62+
skipConfirm = false,
6263
} = options;
6364

6465
if (dryRun) {
@@ -99,10 +100,12 @@ export async function release(options: ReleaseOptions = {}): Promise<void> {
99100

100101
logger.info(`Direct release: ${version} (${tag})`);
101102

102-
// Confirm release
103-
const confirmed = await confirmRelease(version, tag);
104-
if (!confirmed) {
105-
return;
103+
// Confirm release unless skip-confirm is enabled
104+
if (!skipConfirm) {
105+
const confirmed = await confirmRelease(version, tag);
106+
if (!confirmed) {
107+
return;
108+
}
106109
}
107110
} else {
108111
// Prompt for version and tag
@@ -113,10 +116,12 @@ export async function release(options: ReleaseOptions = {}): Promise<void> {
113116
version = result.version;
114117
tag = result.tag;
115118

116-
// Confirm release
117-
const confirmed = await confirmRelease(version, tag);
118-
if (!confirmed) {
119-
return;
119+
// Confirm release unless skip-confirm is enabled
120+
if (!skipConfirm) {
121+
const confirmed = await confirmRelease(version, tag);
122+
if (!confirmed) {
123+
return;
124+
}
120125
}
121126
}
122127

@@ -141,13 +146,15 @@ export async function release(options: ReleaseOptions = {}): Promise<void> {
141146
return;
142147
}
143148

144-
// Confirm packages to publish
145-
const packagesConfirmed = await confirmPackagesToPublish(
146-
packagesToPublish,
147-
canary,
148-
);
149-
if (!packagesConfirmed) {
150-
return;
149+
// Confirm packages to publish unless skip-confirm is enabled
150+
if (!skipConfirm) {
151+
const packagesConfirmed = await confirmPackagesToPublish(
152+
packagesToPublish,
153+
canary,
154+
);
155+
if (!packagesConfirmed) {
156+
return;
157+
}
151158
}
152159

153160
// Update all package versions FIRST (before build)
@@ -213,6 +220,7 @@ export async function release(options: ReleaseOptions = {}): Promise<void> {
213220
pushTag,
214221
canary,
215222
changelogGenerated,
223+
skipConfirm,
216224
);
217225

218226
// Create GitHub release if requested
@@ -244,6 +252,7 @@ async function handleGitOperations(
244252
pushTag: boolean,
245253
canary: boolean,
246254
changelogGenerated = false,
255+
skipConfirm = false,
247256
): Promise<void> {
248257
const tagName = `${tagPrefix}${version}`;
249258

@@ -279,7 +288,7 @@ async function handleGitOperations(
279288
logger.success(`Created git tag: ${tagName}`);
280289

281290
// Handle tag pushing
282-
await handleTagPush(tagName, cwd, pushTag, canary);
291+
await handleTagPush(tagName, cwd, pushTag, canary, skipConfirm);
283292
} catch (err) {
284293
logger.error(`Failed to create git tag: ${(err as Error).message}`);
285294
}
@@ -293,9 +302,13 @@ async function handleTagPush(
293302
cwd: string,
294303
pushTag: boolean,
295304
canary: boolean,
305+
skipConfirm = false,
296306
): Promise<void> {
297307
const shouldPush =
298-
pushTag || (canary ? true : await confirmTagPush(tagName, canary));
308+
pushTag ||
309+
canary ||
310+
skipConfirm ||
311+
await confirmTagPush(tagName, canary);
299312

300313
if (!shouldPush) {
301314
return;

infra/pdk/src/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ export interface ReleaseSpecificOptions {
232232
* Directly specify release tag (skips interactive selection)
233233
*/
234234
releaseTag?: string;
235+
/**
236+
* Skip confirmation prompts during release
237+
*/
238+
skipConfirm?: boolean;
235239
}
236240

237241
/**

0 commit comments

Comments
 (0)