Sha256: dc87f8a008a49faad7cdd379c25886eae408139b6e7cf9352bbe7bd240fc8450

Contents?: true

Size: 901 Bytes

Versions: 4

Compression:

Stored size: 901 Bytes

Contents

# https://buildkite.com/docs/agent/osx
# https://buildkite.com/docs/guides/environment-variables

module Danger
  module CISource
    # https://buildkite.com
    class Buildkite < CI
      def self.validates?(env)
        return false unless env["BUILDKITE"]
        return false unless env["BUILDKITE_PULL_REQUEST_REPO"] && !env["BUILDKITE_PULL_REQUEST_REPO"].empty?
        return false unless env["BUILDKITE_PULL_REQUEST"]

        return true
      end

      def initialize(env)
        self.repo_url = env["BUILDKITE_PULL_REQUEST_REPO"]
        self.pull_request_id = env["BUILDKITE_PULL_REQUEST"]

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
danger-2.0.1 lib/danger/ci_source/buildkite.rb
danger-2.0.0 lib/danger/ci_source/buildkite.rb
danger-0.10.1 lib/danger/ci_source/buildkite.rb
danger-0.10.0 lib/danger/ci_source/buildkite.rb