Sha256: 159604760cd2b05ea24792ac58220b7c11adf32abfffc4b48944f0426e808462

Contents?: true

Size: 1.26 KB

Versions: 34

Compression:

Stored size: 1.26 KB

Contents

# http://devcenter.bitrise.io/docs/available-environment-variables
require "danger/request_sources/github/github"
require "danger/request_sources/gitlab"

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 App Env Vars](https://blog.bitrise.io/anyone-even-prs-can-have-secrets).
  #
  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,
        Danger::RequestSources::BitbucketServer,
        Danger::RequestSources::BitbucketCloud
      ]
    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{([\/:])(([^\/]+\/){1,2}[^\/]+?)(\.git$|$)})
      self.repo_slug = repo_matches[2] unless repo_matches.nil?
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
danger-6.1.0 lib/danger/ci_source/bitrise.rb
danger-6.0.9 lib/danger/ci_source/bitrise.rb
danger-6.0.8 lib/danger/ci_source/bitrise.rb
danger-6.0.7 lib/danger/ci_source/bitrise.rb
danger-6.0.6 lib/danger/ci_source/bitrise.rb
danger-6.0.5 lib/danger/ci_source/bitrise.rb
danger-6.0.4 lib/danger/ci_source/bitrise.rb
danger-6.0.3 lib/danger/ci_source/bitrise.rb
danger-6.0.2 lib/danger/ci_source/bitrise.rb
danger-6.0.1 lib/danger/ci_source/bitrise.rb
danger-6.0.0 lib/danger/ci_source/bitrise.rb
danger-5.16.1 lib/danger/ci_source/bitrise.rb
danger-5.16.0 lib/danger/ci_source/bitrise.rb
danger-5.15.0 lib/danger/ci_source/bitrise.rb
danger-5.14.0 lib/danger/ci_source/bitrise.rb
danger-5.13.0 lib/danger/ci_source/bitrise.rb
danger-5.12.0 lib/danger/ci_source/bitrise.rb
danger-5.11.1 lib/danger/ci_source/bitrise.rb
danger-5.11.0 lib/danger/ci_source/bitrise.rb
danger-5.10.3 lib/danger/ci_source/bitrise.rb