Skip to content

Commit

Permalink
[WIP] config platform
Browse files Browse the repository at this point in the history
  • Loading branch information
HelloCore committed Jun 23, 2019
1 parent abcd849 commit 9d9d17b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions source/platforms/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { GitHub } from "./GitHub"
import { GitHubAPI } from "./github/GitHubAPI"
import { BitBucketServer } from "./BitBucketServer"
import { BitBucketServerAPI, bitbucketServerRepoCredentialsFromEnv } from "./bitbucket_server/BitBucketServerAPI"
import { BitBucketCloud } from "./BitBucketCloud"
import { BitBucketCloudAPI, bitbucketCloudCredentialsFromEnv } from "./bitbucket_cloud/BitBucketCloudAPI"
import GitLabAPI, { getGitLabAPICredentialsFromEnv } from "./gitlab/GitLabAPI"
import GitLab from "./GitLab"
import { DangerResults } from "../dsl/DangerResults"
Expand Down Expand Up @@ -102,6 +104,18 @@ export function getPlatformForEnv(env: Env, source: CISource): Platform {
return new BitBucketServer(api)
}

// Bitbucket Cloud
if (env["DANGER_BITBUCKETCLOUD_USERNAME"] || env["DANGER_PR_PLATFORM"] === BitBucketCloud.name) {
const api = new BitBucketCloudAPI(
{
pullRequestID: source.pullRequestID,
repoSlug: source.repoSlug,
},
bitbucketCloudCredentialsFromEnv(env)
)
return new BitBucketCloud(api)
}

// GitLab
if (env["DANGER_GITLAB_API_TOKEN"] || env["DANGER_PR_PLATFORM"] === GitLab.name) {
const api = new GitLabAPI(
Expand Down

0 comments on commit 9d9d17b

Please sign in to comment.