Class: Danger::Bitrise
Overview
### CI Setup
Add a script step to your workflow:
“‘yml
-
inputs: - content: |- bundle install bundle exec danger
“‘
### Token Setup
Add the ‘DANGER_GITHUB_API_TOKEN` to your workflow’s [Secret App Env Vars](blog.bitrise.io/anyone-even-prs-can-have-secrets).
### bitbucket server and bitrsie
Danger will read the environemnt variable GIT_REPOSITORY_URL to construct the Bitbucket Server API URL finding the project and repo slug in the GIT_REPOSITORY_URL variable. This GIT_REPOSITORY_URL variable comes from the App Settings tab for your Bitrsie App. If you are manually setting a repo URL in the Git Clone Repo step, you may need to set adjust this propery in the settings tab, maybe even fake it. The pattern used is ‘(%r([/:])(([^/]+/)1,2</a>+?)(1,2</a>+?)(.git$|$)`.
Instance Attribute Summary
Attributes inherited from CI
#pull_request_id, #repo_slug, #repo_url
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(env) ⇒ Bitrise
constructor
A new instance of Bitrise.
- #supported_request_sources ⇒ Object
Methods inherited from CI
available_ci_sources, inherited, #supports?
Constructor Details
#initialize(env) ⇒ Bitrise
Returns a new instance of Bitrise.
48 49 50 51 52 53 54 |
# File 'lib/danger/ci_source/bitrise.rb', line 48 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{([\/:])(([^\/]+\/){1,2}[^\/]+?)(\.git$|$)}) self.repo_slug = repo_matches[2] unless repo_matches.nil? end |
Class Method Details
.validates_as_ci?(env) ⇒ Boolean
31 32 33 |
# File 'lib/danger/ci_source/bitrise.rb', line 31 def self.validates_as_ci?(env) env.key? "BITRISE_IO" end |
.validates_as_pr?(env) ⇒ Boolean
35 36 37 |
# File 'lib/danger/ci_source/bitrise.rb', line 35 def self.validates_as_pr?(env) return !env["BITRISE_PULL_REQUEST"].to_s.empty? end |
Instance Method Details
#supported_request_sources ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/danger/ci_source/bitrise.rb', line 39 def supported_request_sources @supported_request_sources ||= [ Danger::RequestSources::GitHub, Danger::RequestSources::GitLab, Danger::RequestSources::BitbucketServer, Danger::RequestSources::BitbucketCloud ] end |