Skip to content

Commit

Permalink
fix(pm): correct sha for last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuri committed Aug 20, 2017
1 parent 41c00a0 commit a8fbc45
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/api/process-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ function prepareJob(buildId: number, jobId: number, cmds: any, sshAndVnc = false
.then(() => getBuild(buildId))
.then(build => {
if (build.repository.access_token) {
const sha = build.data.after;
const sha = build.data.after || build.data.pull_request.head.sha;
const name = build.data.repository.full_name;
const gitUrl = `https://api.github.com/repos/${name}/statuses/${sha}`;
const abstruseUrl = `${config.url}/build/${buildId}`;
Expand Down Expand Up @@ -358,7 +358,7 @@ function prepareJob(buildId: number, jobId: number, cmds: any, sshAndVnc = false
.then(() => getBuild(buildId))
.then(build => {
if (build.repository.access_token) {
const sha = build.data.after;
const sha = build.data.after || build.data.pull_request.head.sha;
const name = build.data.repository.full_name;
const gitUrl = `https://api.github.com/repos/${name}/statuses/${sha}`;
const abstruseUrl = `${config.url}/build/${buildId}`;
Expand Down Expand Up @@ -453,7 +453,7 @@ export function stopBuild(buildId: number): Promise<any> {
const abstruseUrl = `${config.url}/build/${buildId}`;
return setGitHubStatusFailure(gitUrl, abstruseUrl, buildData.repository.access_token);
}
});
}).catch(err => console.error(err));
}

export function restartJob(jobId: number): Promise<void> {
Expand Down Expand Up @@ -481,7 +481,7 @@ export function restartJob(jobId: number): Promise<void> {
.then(() => getBuild(jobData.builds_id))
.then(build => {
if (build.repository.access_token) {
const sha = build.data.after;
const sha = build.data.after || build.data.pull_request.head.sha;
const name = build.data.repository.full_name;
const gitUrl = `https://api.github.com/repos/${name}/statuses/${sha}`;
const abstruseUrl = `${config.url}/build/${jobData.build_id}`;
Expand All @@ -490,7 +490,7 @@ export function restartJob(jobId: number): Promise<void> {
} else {
return Promise.resolve();
}
});
}).catch(err => console.error(err));
}

export function restartJobWithSshAndVnc(jobId: number): Promise<void> {
Expand Down Expand Up @@ -518,7 +518,7 @@ export function restartJobWithSshAndVnc(jobId: number): Promise<void> {
.then(() => getBuild(jobData.builds_id))
.then(build => {
if (build.repository.access_token) {
const sha = build.data.after;
const sha = build.data.after || build.data.pull_request.head.sha;
const name = build.data.repository.full_name;
const gitUrl = `https://api.github.com/repos/${name}/statuses/${sha}`;
const abstruseUrl = `${config.url}/build/${jobData.build_id}`;
Expand Down

0 comments on commit a8fbc45

Please sign in to comment.