class Danger::CircleCI

### CI Setup

For setting up CircleCI, we recommend turning on “Only build pull requests” in “Advanced Settings.” Without this enabled, it’s trickier for Danger to determine whether you’re in a pull request or not, as the environment metadata isn’t as reliable.

A common scenario is when CircleCI begins building a commit before the commit becomes associated with a PR (e.g. a developer pushes their branch to the remote repo for the first time. CircleCI spins up and begins building. Moments later the developer creates a PR on GitHub. Since the build process started before the PR existed, Danger won’t be able to use the Circle-provided environment variables to retrieve PR metadata.)

With “Only build pull requests” enabled, you can add ‘bundle exec danger` to your `config.yml` (Circle 2.0).

e.g.

```yaml
- run: bundle exec danger --verbose
```

And that should be it!

### Token Setup

If “Only build pull requests” can’t be enabled for your project, Danger can still work by relying on CircleCI’s API to retrieve PR metadata, which will require an API token.

  1. Go to your project > Settings > API Permissions. Create a token with scope “view-builds” and a label like “DANGER_CIRCLE_CI_API_TOKEN”.

  2. Settings > Environment Variables. Add the token as a CircleCI environment variable, which exposes it to the Danger process.

There is no difference here for OSS vs Closed, both scenarios will need this environment variable.

With these pieces in place, Danger should be able to work as expected.