Class: Danger::Codeship
Overview
### CI Setup
In Codeship, go to your “Project Settings”, then add ‘bundle exec danger` as a test step inside one of your pipelines.
### Token Setup
Add your ‘DANGER_GITHUB_API_TOKEN` to “Environment” section in “Project Settings”.
Instance Attribute Summary
Attributes inherited from CI
#pull_request_id, #repo_slug, #repo_url
Class Method Summary collapse
- .owner_for_github(env) ⇒ Object
-
.pr_from_env(env) ⇒ Object
this is fairly hacky, see github.com/danger/danger/pull/892#issuecomment-329030616 for why.
- .validates_as_ci?(env) ⇒ Boolean
- .validates_as_pr?(env) ⇒ Boolean
Instance Method Summary collapse
-
#initialize(env) ⇒ Codeship
constructor
A new instance of Codeship.
- #supported_request_sources ⇒ Object
Methods inherited from CI
available_ci_sources, inherited, #supports?
Constructor Details
Class Method Details
.owner_for_github(env) ⇒ Object
27 28 29 |
# File 'lib/danger/ci_source/codeship.rb', line 27 def self.owner_for_github(env) env["CI_REPO_NAME"].split("/").first end |
.pr_from_env(env) ⇒ Object
this is fairly hacky, see github.com/danger/danger/pull/892#issuecomment-329030616 for why
32 33 34 |
# File 'lib/danger/ci_source/codeship.rb', line 32 def self.pr_from_env(env) Danger::RequestSources::GitHub.new(nil, env).get_pr_from_branch(env["CI_REPO_NAME"], env["CI_BRANCH"], owner_for_github(env)) end |
.validates_as_ci?(env) ⇒ Boolean
17 18 19 |
# File 'lib/danger/ci_source/codeship.rb', line 17 def self.validates_as_ci?(env) env["CI_NAME"] == "codeship" end |
.validates_as_pr?(env) ⇒ Boolean
21 22 23 24 25 |
# File 'lib/danger/ci_source/codeship.rb', line 21 def self.validates_as_pr?(env) return false unless env["CI_BRANCH"] && !env["CI_BRANCH"].empty? !pr_from_env(env).nil? end |
Instance Method Details
#supported_request_sources ⇒ Object
36 37 38 |
# File 'lib/danger/ci_source/codeship.rb', line 36 def supported_request_sources @supported_request_sources ||= [Danger::RequestSources::GitHub] end |