Sha256: 85d0e8f9fa0329fd50706a8a597b845c8efe72d0856c245150b28eecb29fbb1a

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

require "danger/request_sources/github/github"

module Danger
  # ### CI Setup
  # You need to edit your `.cirrus.yml` to include `bundle exec danger`.
  #
  # Adding this to your `.cirrus.yml` allows Danger to fail your build, both on the Cirrus CI website and within your Pull Request.
  # With that set up, you can edit your job to add `bundle exec danger` at the build action.
  #
  # ### Token Setup
  class Cirrus < CI
    def self.validates_as_ci?(env)
      env.key? "CIRRUS_CI"
    end

    def self.validates_as_pr?(env)
      exists = ["CIRRUS_PR", "CIRRUS_REPO_FULL_NAME"].all? { |x| env[x] && !env[x].empty? }
      exists && env["CIRRUS_PR"].to_i > 0
    end

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

    def initialize(env)
      self.repo_slug = env["CIRRUS_REPO_FULL_NAME"]
      if env["CIRRUS_PR"].to_i > 0
        self.pull_request_id = env["CIRRUS_BUILD_ID"]
      end
      self.repo_url = env["CIRRUS_GIT_CLONE_URL"]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
danger-6.0.3 lib/danger/ci_source/cirrus.rb
danger-6.0.2 lib/danger/ci_source/cirrus.rb