Class: Danger::XcodeCloud

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

Overview

### CI Setup

In order to work with Xcode Cloud and Danger, you will need to add ‘bundle exec danger` to the `ci_scripts/ci_post_xcodebuild.sh` (Xcode Cloud’s expected filename for a post-action build script). More details and documentation on Xcode Cloud configuration can be found [here](developer.apple.com/documentation/xcode/writing-custom-build-scripts).

### Token Setup

You will need to add the ‘DANGER_GITHUB_API_TOKEN` to your build environment. If running on GitHub Enterprise, make sure you also set the expected values for both `DANGER_GITHUB_API_HOST` and `DANGER_GITHUB_HOST`.

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

Returns a new instance of XcodeCloud.



32
33
34
35
36
# File 'lib/danger/ci_source/xcode_cloud.rb', line 32

def initialize(env)
  self.repo_slug = env["CI_PULL_REQUEST_SOURCE_REPO"]
  self.pull_request_id = env["CI_PULL_REQUEST_NUMBER"]
  self.repo_url = env["CI_PULL_REQUEST_HTML_URL"]
end

Class Method Details

.validates_as_ci?(env) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/danger/ci_source/xcode_cloud.rb', line 15

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

.validates_as_pr?(env) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/danger/ci_source/xcode_cloud.rb', line 19

def self.validates_as_pr?(env)
  env.key? "CI_PULL_REQUEST_NUMBER"
end

Instance Method Details

#supported_request_sourcesObject



23
24
25
26
27
28
29
30
# File 'lib/danger/ci_source/xcode_cloud.rb', line 23

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