Class: Danger::Drone
Overview
### 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`.
Instance Attribute Summary
Attributes inherited from CI
#pull_request_id, #repo_slug, #repo_url
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(env) ⇒ Drone
constructor
A new instance of Drone.
- #supported_request_sources ⇒ Object
Methods inherited from CI
available_ci_sources, inherited, #supports?
Constructor Details
#initialize(env) ⇒ Drone
Returns a new instance of Drone.
35 36 37 38 39 |
# File 'lib/danger/ci_source/drone.rb', line 35 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 |
Class Method Details
.validates_as_ci?(env) ⇒ Boolean
23 24 25 |
# File 'lib/danger/ci_source/drone.rb', line 23 def self.validates_as_ci?(env) env.key? "DRONE_REPO" end |
.validates_as_pr?(env) ⇒ Boolean
27 28 29 |
# File 'lib/danger/ci_source/drone.rb', line 27 def self.validates_as_pr?(env) env["DRONE_PULL_REQUEST"].to_i > 0 end |
Instance Method Details
#supported_request_sources ⇒ Object
31 32 33 |
# File 'lib/danger/ci_source/drone.rb', line 31 def supported_request_sources @supported_request_sources ||= [Danger::RequestSources::GitHub, Danger::RequestSources::GitLab] end |