Sha256: fd8960fde4173819136b8199ec65a2e84081c983fb065d6de813e888d742eddb

Contents?: true

Size: 1.58 KB

Versions: 58

Compression:

Stored size: 1.58 KB

Contents

# https://docs.codemagic.io/building/environment-variables/

module Danger
  # ### 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.
  # https://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.
  #
  class Codemagic < CI
    def self.validates_as_ci?(env)
      env.key? "FCI_PROJECT_ID"
    end

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

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

    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
  end
end

Version data entries

58 entries across 58 versions & 2 rubygems

Version Path
danger-9.5.1 lib/danger/ci_source/codemagic.rb
danger-9.5.0 lib/danger/ci_source/codemagic.rb
danger-9.4.3 lib/danger/ci_source/codemagic.rb
danger-9.4.2 lib/danger/ci_source/codemagic.rb
danger-9.4.1 lib/danger/ci_source/codemagic.rb
danger-9.4.0 lib/danger/ci_source/codemagic.rb
danger-9.3.2 lib/danger/ci_source/codemagic.rb
danger-additional-logging-0.0.36 lib/danger/ci_source/codemagic.rb
danger-additional-logging-0.0.35 lib/danger/ci_source/codemagic.rb
danger-additional-logging-0.0.34 lib/danger/ci_source/codemagic.rb
danger-additional-logging-0.0.33 lib/danger/ci_source/codemagic.rb
danger-additional-logging-0.0.32 lib/danger/ci_source/codemagic.rb
danger-additional-logging-0.0.31 lib/danger/ci_source/codemagic.rb
danger-additional-logging-0.0.30 lib/danger/ci_source/codemagic.rb
danger-additional-logging-0.0.29 lib/danger/ci_source/codemagic.rb
danger-additional-logging-0.0.28 lib/danger/ci_source/codemagic.rb
danger-additional-logging-0.0.27 lib/danger/ci_source/codemagic.rb
danger-additional-logging-0.0.26 lib/danger/ci_source/codemagic.rb
danger-additional-logging-0.0.25 lib/danger/ci_source/codemagic.rb
danger-additional-logging-0.0.24 lib/danger/ci_source/codemagic.rb