Sha256: f0d66bc1328dba232182b8606273c71e057f765fb9d648f8057652ef257953d4

Contents?: true

Size: 935 Bytes

Versions: 8

Compression:

Stored size: 935 Bytes

Contents

module Danger
  # ### CI Setup
  #
  # Install dependencies and add a danger step to your `bitbucket-pipelines.yml`.
  # ```yaml
  #   script:
  #     - bundle exec danger --verbose
  # ```
  #
  # #### Token Setup
  # 
  # Add `DANGER_BITBUCKETCLOUD_USERNAME` and `DANGER_BITBUCKETCLOUD_USERNAME` to your pipeline repository variable.
  # Settings > Pipelines > Repository Variables

  class BitbucketPipelines < CI

    def self.validates_as_ci?(env)
      env.key? "BITBUCKET_BUILD_NUMBER"
    end

    def self.validates_as_pr?(env)
      env.key? "BITBUCKET_PR_ID"
    end

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

    def initialize(env)
      self.repo_url = env["BITBUCKET_GIT_HTTP_ORIGIN"]
      self.repo_slug = "#{env["BITBUCKET_REPO_OWNER"]}/#{env["BITBUCKET_REPO_SLUG"]}"
      self.pull_request_id = env["BITBUCKET_PR_ID"]
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
danger-6.0.2 lib/danger/ci_source/bitbucket_pipelines.rb
danger-6.0.1 lib/danger/ci_source/bitbucket_pipelines.rb
danger-6.0.0 lib/danger/ci_source/bitbucket_pipelines.rb
danger-5.16.1 lib/danger/ci_source/bitbucket_pipelines.rb
danger-5.16.0 lib/danger/ci_source/bitbucket_pipelines.rb
danger-5.15.0 lib/danger/ci_source/bitbucket_pipelines.rb
danger-5.14.0 lib/danger/ci_source/bitbucket_pipelines.rb
danger-5.13.0 lib/danger/ci_source/bitbucket_pipelines.rb