lib/danger/ci_source/surf.rb in danger-2.0.1 vs lib/danger/ci_source/surf.rb in danger-2.1.0
- old
+ new
@@ -1,25 +1,36 @@
# http://github.com/surf-build/surf
module Danger
- module CISource
- # http://github.com/surf-build/surf
- class Surf < CI
- def self.validates?(env)
- return ["SURF_REPO", "SURF_NWO"].all? { |x| env[x] }
- end
+ # ### CI Setup
+ #
+ # You want to add `bundle exec danger` to your `build.sh` file to run Danger at the
+ # end of your build.
+ #
+ # ### 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 Surf < CI
+ def self.validates_as_ci?(env)
+ return ["SURF_REPO", "SURF_NWO"].all? { |x| env[x] }
+ end
- def supported_request_sources
- @supported_request_sources ||= [Danger::RequestSources::GitHub]
- end
+ def self.validates_as_pr?(_)
+ true
+ end
- def initialize(env)
- self.repo_slug = env["SURF_NWO"]
- if env["SURF_PR_NUM"].to_i > 0
- self.pull_request_id = env["SURF_PR_NUM"]
- end
+ def supported_request_sources
+ @supported_request_sources ||= [Danger::RequestSources::GitHub]
+ end
- self.repo_url = env["SURF_REPO"]
+ def initialize(env)
+ self.repo_slug = env["SURF_NWO"]
+ if env["SURF_PR_NUM"].to_i > 0
+ self.pull_request_id = env["SURF_PR_NUM"]
end
+
+ self.repo_url = env["SURF_REPO"]
end
end
end