File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,12 @@ const getPkgRoot = pkg => path.resolve(__dirname, '../packages/' + pkg)
79
79
const step = msg => console . log ( chalk . cyan ( msg ) )
80
80
81
81
async function main ( ) {
82
+ if ( ! ( await isInSyncWithRemote ( ) ) ) {
83
+ return
84
+ } else {
85
+ console . log ( `${ chalk . green ( `✓` ) } commit is up-to-date with rmeote.\n` )
86
+ }
87
+
82
88
let targetVersion = args . _ [ 0 ]
83
89
84
90
if ( isCanary ) {
@@ -299,6 +305,28 @@ async function getCIResult() {
299
305
const data = await res . json ( )
300
306
return data . workflow_runs . length > 0
301
307
} catch ( e ) {
308
+ console . error ( 'Failed to get CI status for current commit.' )
309
+ return false
310
+ }
311
+ }
312
+
313
+ async function isInSyncWithRemote ( ) {
314
+ try {
315
+ const { stdout : sha } = await execa ( 'git' , [ 'rev-parse' , 'HEAD' ] )
316
+ const { stdout : branch } = await execa ( 'git' , [
317
+ 'rev-parse' ,
318
+ '--abbrev-ref' ,
319
+ 'HEAD'
320
+ ] )
321
+ const res = await fetch (
322
+ `https://api.github.com/repos/vuejs/core/commits/${ branch } ?per_page=1`
323
+ )
324
+ const data = await res . json ( )
325
+ return data . sha === sha
326
+ } catch ( e ) {
327
+ console . error (
328
+ 'Failed to check whether local HEAD is up-to-date with remote.'
329
+ )
302
330
return false
303
331
}
304
332
}
You can’t perform that action at this time.
0 commit comments