Skip to content

Latest commit

 

History

History
70 lines (48 loc) · 2.39 KB

README.md

File metadata and controls

70 lines (48 loc) · 2.39 KB

Danger

Danger runs during Mongoid projects' CI process, and gives you a chance to automate common code review chores.

Build Status

Setup

Enable Danger for a project within the mongoid organization. This involves adding a token in Travis-CI and making some build script changes. See mongoid-compatibility#3 for a complete example.

Set DANGER_GITHUB_API_TOKEN in Travis-CI

In Travis-CI, choose Settings and add DANGER_GITHUB_API_TOKEN in Environment Variables. Tick the Display value in build log option to enable Danger in pull requests. Set the value to the API key for the mongoid-bot user, look in a recent build for this project for its value.

Add Danger to Gemfile

Add mongoid-danger to Gemfile.

gem 'mongoid-danger', '~> 0.1.0', require: false

Add Dangerfile

Commit a Dangerfile, eg. mongoid-compatibility's Dangerfile.

Add Danger to GitHub Actions

Add .github/workflows/danger.yml, eg. mongoid-compatibility's danger.yml.

name: PR Linter
on: [pull_request]
jobs:
  danger:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: 2.6
          bundler-cache: true
      - run: |
          # the personal token is public, this is ok, base64 encode to avoid tripping Github
          TOKEN=$(echo -n NWY1ZmM5MzEyMzNlYWY4OTZiOGU3MmI3MWQ3Mzk0MzgxMWE4OGVmYwo= | base64 --decode)
          DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose

Add Danger to Travis-CI

Add Danger to .travis.yml, eg. mongoid-compatibility's Travis.yml.

matrix:
  include:
    - rvm: 2.3.1
      script:
        - bundle exec danger

Commit via a Pull Request

To test things out, make a pull request without CHANGELOG.md changes. Iterate until green.

License

MIT License. See LICENSE for details.