@@ -326,7 +326,7 @@ function prepareJob(buildId: number, jobId: number, cmds: any, sshAndVnc = false
326
326
. then ( ( ) => getBuild ( buildId ) )
327
327
. then ( build => {
328
328
if ( build . repository . access_token ) {
329
- const sha = build . data . after ;
329
+ const sha = build . data . after || build . data . pull_request . head . sha ;
330
330
const name = build . data . repository . full_name ;
331
331
const gitUrl = `https://api.github.com/repos/${ name } /statuses/${ sha } ` ;
332
332
const abstruseUrl = `${ config . url } /build/${ buildId } ` ;
@@ -358,7 +358,7 @@ function prepareJob(buildId: number, jobId: number, cmds: any, sshAndVnc = false
358
358
. then ( ( ) => getBuild ( buildId ) )
359
359
. then ( build => {
360
360
if ( build . repository . access_token ) {
361
- const sha = build . data . after ;
361
+ const sha = build . data . after || build . data . pull_request . head . sha ;
362
362
const name = build . data . repository . full_name ;
363
363
const gitUrl = `https://api.github.com/repos/${ name } /statuses/${ sha } ` ;
364
364
const abstruseUrl = `${ config . url } /build/${ buildId } ` ;
@@ -453,7 +453,7 @@ export function stopBuild(buildId: number): Promise<any> {
453
453
const abstruseUrl = `${ config . url } /build/${ buildId } ` ;
454
454
return setGitHubStatusFailure ( gitUrl , abstruseUrl , buildData . repository . access_token ) ;
455
455
}
456
- } ) ;
456
+ } ) . catch ( err => console . error ( err ) ) ;
457
457
}
458
458
459
459
export function restartJob ( jobId : number ) : Promise < void > {
@@ -481,7 +481,7 @@ export function restartJob(jobId: number): Promise<void> {
481
481
. then ( ( ) => getBuild ( jobData . builds_id ) )
482
482
. then ( build => {
483
483
if ( build . repository . access_token ) {
484
- const sha = build . data . after ;
484
+ const sha = build . data . after || build . data . pull_request . head . sha ;
485
485
const name = build . data . repository . full_name ;
486
486
const gitUrl = `https://api.github.com/repos/${ name } /statuses/${ sha } ` ;
487
487
const abstruseUrl = `${ config . url } /build/${ jobData . build_id } ` ;
@@ -490,7 +490,7 @@ export function restartJob(jobId: number): Promise<void> {
490
490
} else {
491
491
return Promise . resolve ( ) ;
492
492
}
493
- } ) ;
493
+ } ) . catch ( err => console . error ( err ) ) ;
494
494
}
495
495
496
496
export function restartJobWithSshAndVnc ( jobId : number ) : Promise < void > {
@@ -518,7 +518,7 @@ export function restartJobWithSshAndVnc(jobId: number): Promise<void> {
518
518
. then ( ( ) => getBuild ( jobData . builds_id ) )
519
519
. then ( build => {
520
520
if ( build . repository . access_token ) {
521
- const sha = build . data . after ;
521
+ const sha = build . data . after || build . data . pull_request . head . sha ;
522
522
const name = build . data . repository . full_name ;
523
523
const gitUrl = `https://api.github.com/repos/${ name } /statuses/${ sha } ` ;
524
524
const abstruseUrl = `${ config . url } /build/${ jobData . build_id } ` ;
0 commit comments