Sha256: 317d8deb5fcf597f06a9c134ad606b03c73f5ffbb30984da6c6c802b44a1145a

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

# http://readme.drone.io/usage/variables/

module Danger
  # ### CI Setup
  #
  # With Drone you run the docker images yourself, so you will want to add `bundle exec danger` at the end of
  # your `.drone.yml`.
  #
  #  ``` shell
  #   build:
  #     image: golang
  #       commands:
  #         - ...
  #         - bundle exec danger
  #  ```
  #
  # ### Token Setup
  #
  # As this is self-hosted, you will need to add the `DANGER_GITHUB_API_TOKEN` to your build user's ENV. The alternative
  # is to pass in the token as a prefix to the command `DANGER_GITHUB_API_TOKEN="123" bundle exec danger`.
  #
  class Drone < CI
    def self.validates_as_ci?(env)
      env.key? "DRONE_REPO"
    end

    def self.validates_as_pr?(env)
      env["DRONE_PULL_REQUEST"].to_i > 0
    end

    def supported_request_sources
      @supported_request_sources ||= [Danger::RequestSources::GitHub]
    end

    def initialize(env)
      self.repo_slug = env["DRONE_REPO"]
      self.pull_request_id = env["DRONE_PULL_REQUEST"]
      self.repo_url = GitRepo.new.origins # Drone doesn't provide a repo url env variable :/
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
danger-2.1.6 lib/danger/ci_source/drone.rb
danger-2.1.5 lib/danger/ci_source/drone.rb
danger-2.1.4 lib/danger/ci_source/drone.rb
danger-2.1.3 lib/danger/ci_source/drone.rb
danger-2.1.2 lib/danger/ci_source/drone.rb
danger-2.1.1 lib/danger/ci_source/drone.rb
danger-2.1.0 lib/danger/ci_source/drone.rb