Skip to content

Commit

Permalink
Merge pull request #908 from danger/bitrise_commit_hash
Browse files Browse the repository at this point in the history
Take commit hash from bitrise env
  • Loading branch information
orta committed Aug 8, 2019
2 parents b5c0919 + 2d2c935 commit beac295
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

<!-- Your comment below this -->

- Take commit hash from bitrise env - [@f-meloni]

# 9.1.4

- Use new env `BITBUCKET_REPO_FULL_NAME` in bitbucket pipeline. - [@Soyn]
Expand Down
6 changes: 5 additions & 1 deletion source/ci_source/providers/Bitrise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ export class Bitrise implements CISource {
}

get ciRunURL() {
return process.env.BITRISE_PULL_REQUEST
return this.env.BITRISE_PULL_REQUEST
}

get commitHash() {
return this.env.BITRISE_GIT_COMMIT
}
}
16 changes: 16 additions & 0 deletions source/ci_source/providers/_tests/_bitrise.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,19 @@ describe(".repoSlug", () => {
expect(bitrise.repoSlug).toEqual("artsy/eigen")
})
})

describe("commit hash", () => {
it("returns correct commit hash when present", () => {
const env = {
...correctEnv,
BITRISE_GIT_COMMIT: "1234abc",
}
const bitrise = new Bitrise(env)
expect(bitrise.commitHash).toEqual("1234abc")
})

it("returns no commit hash when not present", () => {
const bitrise = new Bitrise(correctEnv)
expect(bitrise.commitHash).toBeUndefined()
})
})

0 comments on commit beac295

Please sign in to comment.