Class: Danger::CISource::Buildkite

Inherits:
CI
  • Object
show all
Defined in:
lib/danger/ci_source/buildkite.rb

Overview

Instance Attribute Summary

Attributes inherited from CI

#pull_request_id, #repo_slug, #repo_url

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CI

available_ci_sources, inherited, #supports?

Constructor Details

#initialize(env) ⇒ Buildkite

Returns a new instance of Buildkite.



16
17
18
19
20
21
22
# File 'lib/danger/ci_source/buildkite.rb', line 16

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

Class Method Details

.validates?(env) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
# File 'lib/danger/ci_source/buildkite.rb', line 8

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

Instance Method Details

#supported_request_sourcesObject



24
25
26
# File 'lib/danger/ci_source/buildkite.rb', line 24

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