From 7a0944f394ddb06cd6c704c6b7a809177857d434 Mon Sep 17 00:00:00 2001 From: Franco Meloni Date: Tue, 6 Aug 2019 22:30:05 +0100 Subject: [PATCH 1/2] Add bitrise commit hash --- source/ci_source/providers/Bitrise.ts | 6 +++++- .../ci_source/providers/_tests/_bitrise.test.ts | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/source/ci_source/providers/Bitrise.ts b/source/ci_source/providers/Bitrise.ts index 0bd09ada3..641448ddc 100644 --- a/source/ci_source/providers/Bitrise.ts +++ b/source/ci_source/providers/Bitrise.ts @@ -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 } } diff --git a/source/ci_source/providers/_tests/_bitrise.test.ts b/source/ci_source/providers/_tests/_bitrise.test.ts index 721e686e1..def8c0781 100644 --- a/source/ci_source/providers/_tests/_bitrise.test.ts +++ b/source/ci_source/providers/_tests/_bitrise.test.ts @@ -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() + }) +}) From 2d2c9354c4b6eb77dcab01a2f47f877662481381 Mon Sep 17 00:00:00 2001 From: Franco Meloni Date: Tue, 6 Aug 2019 22:33:01 +0100 Subject: [PATCH 2/2] Updated CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf7e0edd0..ad736cf6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ +- Take commit hash from bitrise env - [@f-meloni] + # 9.1.4 - Use new env `BITBUCKET_REPO_FULL_NAME` in bitbucket pipeline. - [@Soyn]