Skip to content

Commit ae09d24

Browse files
committed
workflow: bail release when skipping prompts + CI not passed yet
1 parent 244545c commit ae09d24

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

scripts/release.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,23 @@ async function main() {
252252
let isCIPassed = await getCIResult()
253253
skipTests ||= isCIPassed
254254

255-
if (isCIPassed && !skipPrompts) {
256-
/** @type {{ yes: boolean }} */
257-
const { yes: promptSkipTests } = await prompt({
258-
type: 'confirm',
259-
name: 'yes',
260-
message: `CI for this commit passed. Skip local tests?`,
261-
})
262-
263-
skipTests = promptSkipTests
255+
if (isCIPassed) {
256+
if (!skipPrompts) {
257+
/** @type {{ yes: boolean }} */
258+
const { yes: promptSkipTests } = await prompt({
259+
type: 'confirm',
260+
name: 'yes',
261+
message: `CI for this commit passed. Skip local tests?`,
262+
})
263+
skipTests = promptSkipTests
264+
} else {
265+
skipTests = true
266+
}
267+
} else if (skipPrompts) {
268+
throw new Error(
269+
'CI for the latest commit has not passed yet. ' +
270+
'Only run the release workflow after the CI has passed.',
271+
)
264272
}
265273
}
266274

0 commit comments

Comments
 (0)