Skip to content

Commit

Permalink
Merge pull request #962 from danger/test_types
Browse files Browse the repository at this point in the history
Adds gitlab docs
  • Loading branch information
orta committed Nov 27, 2019
2 parents b188537 + daf1311 commit 6ae125d
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions docs/usage/gitlab.html.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: Danger + GitLab
subtitle: Self-Hosted
layout: guide_js
order: 4
blurb: An overview of using Danger with GitLab, and some examples
---

To use Danger JS with GitLab: you'll need to create a new account for Danger to use, then set the following environment
variables on your CI system:

- `DANGER_GITLAB_HOST` = Defaults to `https://gitlab.com` but you can use it for your own url
- `DANGER_GITLAB_API_TOKEN` = An access token for the account which will post comments

Then in your Dangerfiles you will have a fully fleshed out `danger.gitlab` object to work with. For example:

```ts
import { danger, warn } from "danger"

if (danger.bitbucket_cloud.mr.title.includes("WIP")) {
warn("PR is considered WIP")
}
```

The DSL is expansive, you can see all the details inside the [Danger JS Reference][ref], but the TLDR is:

```ts
danger.gitlab.
/** The pull request and repository metadata */
metadata: RepoMetaData
/** The Merge Request metadata */
mr: BitBucketCloudPRDSL
/** The commits associated with the merge request */
commits: BitBucketCloudCommit[]
```

0 comments on commit 6ae125d

Please sign in to comment.