forked from danger/peril
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreatePRDSL.ts
More file actions
28 lines (25 loc) · 937 Bytes
/
createPRDSL.ts
File metadata and controls
28 lines (25 loc) · 937 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { jsonDSLGenerator } from "danger/distribution/runner/dslGenerator"
import { jsonToDSL } from "danger/distribution/runner/jsonToDSL"
import { getPerilPlatformForDSL } from "../../danger/peril_platform"
import { GitHub } from "danger/distribution/platforms/GitHub"
import { GitHubAPI } from "danger/distribution/platforms/github/GitHubAPI"
import { RunType } from "../../danger/danger_run"
/**
* Generates a full DSL for a PR
*
* @param githubAPI the Danger GithubAPI instance
*/
export const createPRDSL = async (githubAPI: GitHubAPI) => {
const jsonDSL = await createPRJSONDSL(githubAPI)
return await jsonToDSL(jsonDSL)
}
/**
* Generates a full DSL for a PR
*
* @param githubAPI the Danger GithubAPI instance
*/
export const createPRJSONDSL = async (githubAPI: GitHubAPI) => {
const gh = GitHub(githubAPI)
const platform = getPerilPlatformForDSL(RunType.pr, gh, {})
return await jsonDSLGenerator(platform)
}