Sha256: 1915fcb7057347bb6f3c9aed92ffa6b930793a2fea86915f2fd06e114eadedff

Contents?: true

Size: 947 Bytes

Versions: 11

Compression:

Stored size: 947 Bytes

Contents

# http://github.com/surf-build/surf

module Danger
  # ### 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 self.validates_as_pr?(_)
      true
    end

    def supported_request_sources
      @supported_request_sources ||= [Danger::RequestSources::GitHub]
    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

      self.repo_url = env["SURF_REPO"]
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
danger-3.0.3 lib/danger/ci_source/surf.rb
danger-3.0.2 lib/danger/ci_source/surf.rb
danger-3.0.1 lib/danger/ci_source/surf.rb
danger-3.0.0 lib/danger/ci_source/surf.rb
danger-2.1.6 lib/danger/ci_source/surf.rb
danger-2.1.5 lib/danger/ci_source/surf.rb
danger-2.1.4 lib/danger/ci_source/surf.rb
danger-2.1.3 lib/danger/ci_source/surf.rb
danger-2.1.2 lib/danger/ci_source/surf.rb
danger-2.1.1 lib/danger/ci_source/surf.rb
danger-2.1.0 lib/danger/ci_source/surf.rb