Sha256: 2d689194b04bdf416677a3505d93ee0b3c4d1979d063dac64b75c5333018d8ec

Contents?: true

Size: 1006 Bytes

Versions: 4

Compression:

Stored size: 1006 Bytes

Contents

# http://devcenter.bitrise.io/docs/available-environment-variables

module Danger
  # ### CI Setup
  #
  # Add a script step to your workflow:
  # ``` yml
  # - script@1.1.2:
  #     inputs:
  #    - content: |-
  #        bundle install
  #        bundle exec danger
  # ```
  # ### Token Setup
  #
  # Add the `DANGER_GITHUB_API_TOKEN` to your workflow's Secret Env Vars
  #
  class Bitrise < CI
    def self.validates_as_ci?(env)
      env.key? "BITRISE_IO"
    end

    def self.validates_as_pr?(env)
      return !env["BITRISE_PULL_REQUEST"].to_s.empty?
    end

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

    def initialize(env)
      self.pull_request_id = env["BITRISE_PULL_REQUEST"]
      self.repo_url = env["GIT_REPOSITORY_URL"]

      repo_matches = self.repo_url.match(%r{([\/:])([^\/]+\/[^\/.]+)(?:.git)?$})
      self.repo_slug = repo_matches[2] unless repo_matches.nil?
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
danger-3.2.1 lib/danger/ci_source/bitrise.rb
danger-3.2.0 lib/danger/ci_source/bitrise.rb
danger-3.1.1 lib/danger/ci_source/bitrise.rb
danger-3.1.0 lib/danger/ci_source/bitrise.rb