Skip to content

Commit

Permalink
Separate headSha from triggerSha (#790)
Browse files Browse the repository at this point in the history
  • Loading branch information
0x2b3bfa0 authored Oct 29, 2021
1 parent 3037be7 commit 569e548
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/cml.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,12 @@ class CML {
}

async headSha() {
return exec(`git rev-parse HEAD`);
}

async triggerSha() {
const { sha } = getDriver(this);
return sha || (await exec(`git rev-parse HEAD`));
return sha || (await this.headSha());
}

async branch() {
Expand Down Expand Up @@ -165,7 +169,7 @@ class CML {
}

async checkCreate(opts = {}) {
const { headSha = await this.headSha() } = opts;
const { headSha = await this.triggerSha() } = opts;

return await getDriver(this).checkCreate({ ...opts, headSha });
}
Expand Down Expand Up @@ -334,7 +338,7 @@ class CML {
return;
}

const sha = await this.headSha();
const sha = await this.triggerSha();
const shaShort = sha.substr(0, 8);

const target = await this.branch();
Expand Down

2 comments on commit 569e548

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Comment

CML watermark

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Comment

CML watermark

Please sign in to comment.