File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ const {
11
11
runAsync, runSync, forceRunAsync
12
12
} = require ( './run' ) ;
13
13
const Session = require ( './session' ) ;
14
- const { shortSha } = require ( './utils' ) ;
14
+ const { shortSha, isGhAvailable } = require ( './utils' ) ;
15
15
16
16
const isWindows = process . platform === 'win32' ;
17
17
@@ -416,11 +416,16 @@ class LandingSession extends Session {
416
416
}
417
417
418
418
this . cleanFiles ( ) ;
419
- cli . log ( 'Temporary files removed' ) ;
419
+ cli . log ( 'Temporary files removed. ' ) ;
420
420
cli . log ( 'To finish landing:' ) ;
421
- cli . log ( `1. Run \`git push ${ upstream } ${ branch } \`` ) ;
421
+ cli . log ( '1. Run: ' ) ;
422
+ cli . log ( ` git push ${ upstream } ${ branch } ` ) ;
422
423
const url = `https://github.com/${ owner } /${ repo } /pull/${ prid } ` ;
423
424
cli . log ( `2. Post "Landed in ${ willBeLanded } " in ${ url } ` ) ;
425
+ if ( isGhAvailable ( ) ) {
426
+ cli . log ( ` gh pr comment ${ prid } --body "Landed in ${ willBeLanded } "` ) ;
427
+ cli . log ( ` gh pr close ${ prid } ` ) ;
428
+ }
424
429
}
425
430
426
431
async continue ( ) {
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
+ const which = require ( 'which' ) ;
4
+
3
5
exports . ascending = function ( a , b ) {
4
6
if ( a === b ) return 0 ;
5
7
return a < b ? - 1 : 1 ;
@@ -26,3 +28,11 @@ exports.flatten = flatten;
26
28
exports . shortSha = function shortSha ( sha ) {
27
29
return sha . slice ( 0 , 12 ) ;
28
30
} ;
31
+
32
+ let isGhAvailableCache ;
33
+ exports . isGhAvailable = function isGhAvailable ( ) {
34
+ if ( isGhAvailableCache === undefined ) {
35
+ isGhAvailableCache = which . sync ( 'gh' , { nothrow : true } ) !== null ;
36
+ }
37
+ return isGhAvailableCache ;
38
+ } ;
Original file line number Diff line number Diff line change 51
51
"proxy-agent" : " ^5.0.0" ,
52
52
"replace-in-file" : " ^6.2.0" ,
53
53
"rimraf" : " ^3.0.2" ,
54
+ "which" : " ^2.0.2" ,
54
55
"yargs" : " ^16.2.0"
55
56
},
56
57
"devDependencies" : {
You can’t perform that action at this time.
0 commit comments