Sha256: 209f6b9d211c0c34ddf7fc57661d6bb67f95b17b46b689712d0bc80fa6ce0378

Contents?: true

Size: 1.03 KB

Versions: 9

Compression:

Stored size: 1.03 KB

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
  # or instead using `DANGER_BITBUCKETCLOUD_OAUTH_KEY` and `DANGER_BITBUCKETCLOUD_OAUTH_SECRET`.
  #
  # You can find them in 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

9 entries across 9 versions & 1 rubygems

Version Path
danger-6.2.0 lib/danger/ci_source/bitbucket_pipelines.rb
danger-6.1.0 lib/danger/ci_source/bitbucket_pipelines.rb
danger-6.0.9 lib/danger/ci_source/bitbucket_pipelines.rb
danger-6.0.8 lib/danger/ci_source/bitbucket_pipelines.rb
danger-6.0.7 lib/danger/ci_source/bitbucket_pipelines.rb
danger-6.0.6 lib/danger/ci_source/bitbucket_pipelines.rb
danger-6.0.5 lib/danger/ci_source/bitbucket_pipelines.rb
danger-6.0.4 lib/danger/ci_source/bitbucket_pipelines.rb
danger-6.0.3 lib/danger/ci_source/bitbucket_pipelines.rb