@@ -326,7 +326,7 @@ function prepareJob(buildId: number, jobId: number, cmds: any, sshAndVnc = false
326326 . then ( ( ) => getBuild ( buildId ) )
327327 . then ( build => {
328328 if ( build . repository . access_token ) {
329- const sha = build . data . after ;
329+ const sha = build . data . after || build . data . pull_request . head . sha ;
330330 const name = build . data . repository . full_name ;
331331 const gitUrl = `https://api.github.com/repos/${ name } /statuses/${ sha } ` ;
332332 const abstruseUrl = `${ config . url } /build/${ buildId } ` ;
@@ -358,7 +358,7 @@ function prepareJob(buildId: number, jobId: number, cmds: any, sshAndVnc = false
358358 . then ( ( ) => getBuild ( buildId ) )
359359 . then ( build => {
360360 if ( build . repository . access_token ) {
361- const sha = build . data . after ;
361+ const sha = build . data . after || build . data . pull_request . head . sha ;
362362 const name = build . data . repository . full_name ;
363363 const gitUrl = `https://api.github.com/repos/${ name } /statuses/${ sha } ` ;
364364 const abstruseUrl = `${ config . url } /build/${ buildId } ` ;
@@ -453,7 +453,7 @@ export function stopBuild(buildId: number): Promise<any> {
453453 const abstruseUrl = `${ config . url } /build/${ buildId } ` ;
454454 return setGitHubStatusFailure ( gitUrl , abstruseUrl , buildData . repository . access_token ) ;
455455 }
456- } ) ;
456+ } ) . catch ( err => console . error ( err ) ) ;
457457}
458458
459459export function restartJob ( jobId : number ) : Promise < void > {
@@ -481,7 +481,7 @@ export function restartJob(jobId: number): Promise<void> {
481481 . then ( ( ) => getBuild ( jobData . builds_id ) )
482482 . then ( build => {
483483 if ( build . repository . access_token ) {
484- const sha = build . data . after ;
484+ const sha = build . data . after || build . data . pull_request . head . sha ;
485485 const name = build . data . repository . full_name ;
486486 const gitUrl = `https://api.github.com/repos/${ name } /statuses/${ sha } ` ;
487487 const abstruseUrl = `${ config . url } /build/${ jobData . build_id } ` ;
@@ -490,7 +490,7 @@ export function restartJob(jobId: number): Promise<void> {
490490 } else {
491491 return Promise . resolve ( ) ;
492492 }
493- } ) ;
493+ } ) . catch ( err => console . error ( err ) ) ;
494494}
495495
496496export function restartJobWithSshAndVnc ( jobId : number ) : Promise < void > {
@@ -518,7 +518,7 @@ export function restartJobWithSshAndVnc(jobId: number): Promise<void> {
518518 . then ( ( ) => getBuild ( jobData . builds_id ) )
519519 . then ( build => {
520520 if ( build . repository . access_token ) {
521- const sha = build . data . after ;
521+ const sha = build . data . after || build . data . pull_request . head . sha ;
522522 const name = build . data . repository . full_name ;
523523 const gitUrl = `https://api.github.com/repos/${ name } /statuses/${ sha } ` ;
524524 const abstruseUrl = `${ config . url } /build/${ jobData . build_id } ` ;
0 commit comments