@@ -15,7 +15,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url))
15
15
const args = minimist ( process . argv . slice ( 2 ) )
16
16
const preId = args . preid || semver . prerelease ( currentVersion ) ?. [ 0 ]
17
17
const isDryRun = args . dry
18
- const skipTests = args . skipTests
18
+ let skipTests = args . skipTests
19
19
const skipBuild = args . skipBuild
20
20
const packages = fs
21
21
. readdirSync ( path . resolve ( __dirname , '../packages' ) )
@@ -31,7 +31,6 @@ const versionIncrements = [
31
31
]
32
32
33
33
const inc = i => semver . inc ( currentVersion , i , preId )
34
- const bin = name => path . resolve ( __dirname , '../node_modules/.bin/' + name )
35
34
const run = ( bin , args , opts = { } ) =>
36
35
execa ( bin , args , { stdio : 'inherit' , ...opts } )
37
36
const dryRun = ( bin , args , opts = { } ) =>
@@ -72,23 +71,52 @@ async function main() {
72
71
}
73
72
74
73
// @ts -ignore
75
- const { yes } = await prompt ( {
74
+ const { yes : confirmRelease } = await prompt ( {
76
75
type : 'confirm' ,
77
76
name : 'yes' ,
78
77
message : `Releasing v${ targetVersion } . Confirm?`
79
78
} )
80
79
81
- if ( ! yes ) {
80
+ if ( ! confirmRelease ) {
82
81
return
83
82
}
84
83
85
- // run tests before release
86
- step ( '\nRunning tests...' )
87
- if ( ! skipTests && ! isDryRun ) {
88
- await run ( bin ( 'jest' ) , [ '--clearCache' ] )
89
- await run ( 'pnpm' , [ 'test' , '--bail' ] )
84
+ step ( 'Checking CI status for HEAD...' )
85
+ let isCIPassed = true
86
+ try {
87
+ const { stdout : sha } = await execa ( 'git' , [ 'rev-parse' , 'HEAD' ] )
88
+ const res = await fetch (
89
+ `https://api.github.com/repos/vuejs/core/actions/runs?head_sha=${ sha } ` +
90
+ `&status=success&exclude_pull_requests=true`
91
+ )
92
+ const data = await res . json ( )
93
+ isCIPassed = data . workflow_runs . length > 0
94
+ } catch ( e ) {
95
+ isCIPassed = false
96
+ }
97
+
98
+ if ( isCIPassed ) {
99
+ // @ts -ignore
100
+ const { yes : promptSkipTests } = await prompt ( {
101
+ type : 'confirm' ,
102
+ name : 'yes' ,
103
+ message : `CI for this commit passed. Skip local tests?`
104
+ } )
105
+ if ( promptSkipTests ) {
106
+ skipTests = true
107
+ }
108
+ }
109
+
110
+ if ( ! skipTests ) {
111
+ step ( '\nRunning tests...' )
112
+ if ( ! isDryRun ) {
113
+ await run ( 'pnpm' , [ 'test' ] )
114
+ await run ( 'pnpm' , [ 'test-dts' ] )
115
+ } else {
116
+ console . log ( `Skipped (dry run)` )
117
+ }
90
118
} else {
91
- console . log ( `( skipped)` )
119
+ step ( 'Tests skipped.' )
92
120
}
93
121
94
122
// update all package versions and inter-dependencies
0 commit comments