Class: Danger::Bitrise

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

Overview

### CI Setup

Add a script step to your workflow: “‘ yml

“‘ ### Token Setup

Add the ‘DANGER_GITHUB_API_TOKEN` to your workflow’s App Env Vars. Warning: adding the token as a Secret Env Var will not work for PR builds, as [Bitrise does not expose secret vars to PRs](bitrise.uservoice.com/forums/235233-general/suggestions/11701587-make-secret-env-variables-available-for-prs-from-t).

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) ⇒ Bitrise

Returns a new instance of Bitrise.



34
35
36
37
38
39
40
# File 'lib/danger/ci_source/bitrise.rb', line 34

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{([\/:])([^\/]+\/[^\/.]+)(?:.git)?$})
  self.repo_slug = repo_matches[2] unless repo_matches.nil?
end

Class Method Details

.validates_as_ci?(env) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/danger/ci_source/bitrise.rb', line 22

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

.validates_as_pr?(env) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/danger/ci_source/bitrise.rb', line 26

def self.validates_as_pr?(env)
  return !env["BITRISE_PULL_REQUEST"].to_s.empty?
end

Instance Method Details

#supported_request_sourcesObject



30
31
32
# File 'lib/danger/ci_source/bitrise.rb', line 30

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