Skip to content

Commit

Permalink
added forked mr url
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankatliarchuk committed Oct 1, 2022
1 parent 47d2085 commit 3367329
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions source/ci_source/providers/GitLabCI.ts
Expand Up @@ -23,8 +23,7 @@ export class GitLabCI implements CISource {
}

get repoSlug(): string {
// return this.env.CI_MERGE_REQUEST_PROJECT_PATH || this.env.CI_PROJECT_PATH
return this.env.CI_PROJECT_PATH
return this.env.CI_MERGE_REQUEST_PROJECT_PATH || this.env.CI_PROJECT_PATH
}

get commitHash(): string {
Expand Down
9 changes: 6 additions & 3 deletions source/ci_source/providers/_tests/_gitlab.test.ts
Expand Up @@ -5,7 +5,6 @@ const correctEnv = {
GITLAB_CI: "true",
CI_MERGE_REQUEST_IID: "27117",
CI_PROJECT_PATH: "gitlab-org/gitlab-foss",
// DANGER_GITLAB_API_TOKEN: "gitlab_dummy_a829-07bd7559eecb"
}

describe("being found when looking for CI", () => {
Expand All @@ -27,8 +26,6 @@ describe(".isCI", () => {
})
})

// missed

describe(".pullRequestID", () => {
it("pulls it out of the env", () => {
const result = new GitLabCI(correctEnv)
Expand All @@ -41,4 +38,10 @@ describe(".repoSlug", () => {
const result = new GitLabCI(correctEnv)
expect(result.repoSlug).toEqual("gitlab-org/gitlab-foss")
})

it("derives it form forked PR Url", () => {
correctEnv["CI_MERGE_REQUEST_PROJECT_PATH"] = "gitlab-org/release-tools"
const result = new GitLabCI(correctEnv)
expect(result.repoSlug).toEqual("gitlab-org/release-tools")
})
})

0 comments on commit 3367329

Please sign in to comment.