Danger :no_entry_sign:

License Gem

Formalize your Pull Request etiquette.

Note: Not ready for public usage yet - unless you're willing to look inside the codebase. This is a Work in progress, though it is active use on Artsy/Eigen and fastlane/fastlane-core.



Add this line to your application's Gemfile:

gem 'danger'

and then run the following to set up danger for your repository

danger init


In CI run bundle exec danger. This will look at your Dangerfile and provide some feedback based on that.


    Danger :no_entry_sign:
:sparkles: lines_of_code The total amount of lines of code in the diff
:pencil2: files_modified The list of files modified
:ship: files_added The list of files added
:recycle: files_removed The list of files removed
:abc: pr_title The title of the PR
:book: pr_body The body of the PR
:busts_in_silhouette: pr_author The author who submitted the PR
:bookmark: pr_labels The labels added to the PR

You can then create a Dangerfile like the following:

# Easy checks
warn("PR is classed as Work in Progress") if pr_title.include? "[WIP]"

if lines_of_code > 50 && files_modified.include?("CHANGELOG.yml") == false
  fail("No CHANGELOG changes made")

# Stop skipping some manual testing
if lines_of_code > 50 && pr_title.include?("📱") == false
   fail("Needs testing on a Phone if change is non-trivial")

message("This pull request adds #{lines_of_code} new lines")
warn("Author @#{pr_author} is not a contributor") unless ["KrauseFx", "orta"].include?(pr_author)


  • GitHub - Built with same-repo PRs in mind


You can access more detailed information by accessing the following variables

  Danger :no_entry_sign:
env.request_source.pr_json The full JSON for the pull request
env.scm.diff The full GitDiff file for the diff.
env.ci_source To get information like the repo slug or pull request ID

Test locally with danger local

Using danger local will look for the last merged pull request in your git history, and apply your current Dangerfile against that Pull Request. Useful when editing.

Useful bits of knowledge ATM

  • You can set the base branch in the command line arguments see: bundle exec danger --help.


This project is open source under the MIT license, which means you have full access to the source code and can modify it to fit your own needs.