class Danger::Codemagic
### CI
Setup
Add a script step to your workflow:
“‘
-
name: Running
Danger
script: |bundle install bundle exec danger
“‘
### Token Setup
Add the following environment variables to your workflow’s environment configuration. docs.codemagic.io/getting-started/yaml/
#### GitHub Add the ‘DANGER_GITHUB_API_TOKEN` to your build user’s ENV.
#### GitLab Add the ‘DANGER_GITLAB_API_TOKEN` to your build user’s ENV.
#### Bitbucket Cloud Add the ‘DANGER_BITBUCKETSERVER_USERNAME`, `DANGER_BITBUCKETSERVER_PASSWORD` to your build user’s ENV.
#### Bitbucket server Add the ‘DANGER_BITBUCKETSERVER_USERNAME`, `DANGER_BITBUCKETSERVER_PASSWORD` and `DANGER_BITBUCKETSERVER_HOST` to your build user’s ENV.
Public Class Methods
new(env)
click to toggle source
# File lib/danger/ci_source/codemagic.rb, line 52 def initialize(env) self.pull_request_id = env["FCI_PULL_REQUEST_NUMBER"] self.repo_slug = env["FCI_REPO_SLUG"] self.repo_url = GitRepo.new.origins # Codemagic doesn't provide a repo url env variable for n end
validates_as_ci?(env)
click to toggle source
# File lib/danger/ci_source/codemagic.rb, line 35 def self.validates_as_ci?(env) env.key? "FCI_PROJECT_ID" end
validates_as_pr?(env)
click to toggle source
# File lib/danger/ci_source/codemagic.rb, line 39 def self.validates_as_pr?(env) return !env["FCI_PULL_REQUEST_NUMBER"].to_s.empty? end
Public Instance Methods
supported_request_sources()
click to toggle source
# File lib/danger/ci_source/codemagic.rb, line 43 def supported_request_sources @supported_request_sources ||= [ Danger::RequestSources::GitHub, Danger::RequestSources::GitLab, Danger::RequestSources::BitbucketServer, Danger::RequestSources::BitbucketCloud ] end