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 {
1111 runAsync, runSync, forceRunAsync
1212} = require ( './run' ) ;
1313const Session = require ( './session' ) ;
14- const { shortSha } = require ( './utils' ) ;
14+ const { shortSha, isGhAvailable } = require ( './utils' ) ;
1515
1616const isWindows = process . platform === 'win32' ;
1717
@@ -416,11 +416,16 @@ class LandingSession extends Session {
416416 }
417417
418418 this . cleanFiles ( ) ;
419- cli . log ( 'Temporary files removed' ) ;
419+ cli . log ( 'Temporary files removed. ' ) ;
420420 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 } ` ) ;
422423 const url = `https://github.com/${ owner } /${ repo } /pull/${ prid } ` ;
423424 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+ }
424429 }
425430
426431 async continue ( ) {
Original file line number Diff line number Diff line change 11'use strict' ;
22
3+ const which = require ( 'which' ) ;
4+
35exports . ascending = function ( a , b ) {
46 if ( a === b ) return 0 ;
57 return a < b ? - 1 : 1 ;
@@ -26,3 +28,11 @@ exports.flatten = flatten;
2628exports . shortSha = function shortSha ( sha ) {
2729 return sha . slice ( 0 , 12 ) ;
2830} ;
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 5151 "proxy-agent" : " ^5.0.0" ,
5252 "replace-in-file" : " ^6.2.0" ,
5353 "rimraf" : " ^3.0.2" ,
54+ "which" : " ^2.0.2" ,
5455 "yargs" : " ^16.2.0"
5556 },
5657 "devDependencies" : {
You can’t perform that action at this time.
0 commit comments