danger 5.7.0 → 5.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/danger/ci_source/code_build.rb +57 -0
- data/lib/danger/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c87de540ebdae8c1567f3c639f29571752e12f9d428ec342aaf646c6ab8aff2
|
4
|
+
data.tar.gz: e58846415de29a5d866bac7ff81b741957e303ed8b7faa0998a785e80c4236ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79aa6162bc5e133428cb5c47c7d03c564aca6d25053ebc674803e6314b2b812ef8126cd6a619bc21b85ace4e625f90ea382643999db5bb80328c4cc687f97dfc
|
7
|
+
data.tar.gz: 287e9ddb8cabfcb8e4028efe0e07e8f739e45e8b9fcbb21c785cc13c6c1e44705f01c0a81d9a93795db473e6ef5e84b1d0c5559ccd1517884b559a1c48a949d4
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
|
2
|
+
require "danger/request_sources/github/github"
|
3
|
+
|
4
|
+
module Danger
|
5
|
+
# ### CI Setup
|
6
|
+
#
|
7
|
+
# In CodeBuild, make sure to correctly forward CODEBUILD_BUILD_ID, CODEBUILD_SOURCE_VERSION, CODEBUILD_SOURCE_REPO_URL and DANGER_GITHUB_API_TOKEN.
|
8
|
+
#
|
9
|
+
# ### Token Setup
|
10
|
+
#
|
11
|
+
# Add your `DANGER_GITHUB_API_TOKEN` to your project. Edit -> Environment -> Additional configuration -> Create a parameter
|
12
|
+
#
|
13
|
+
class CodeBuild < CI
|
14
|
+
def self.validates_as_ci?(env)
|
15
|
+
env.key? "CODEBUILD_BUILD_ID"
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.validates_as_pr?(env)
|
19
|
+
return false unless url = self.extract_pr_url(env)
|
20
|
+
url
|
21
|
+
end
|
22
|
+
|
23
|
+
def supported_request_sources
|
24
|
+
@supported_request_sources ||= [Danger::RequestSources::GitHub]
|
25
|
+
end
|
26
|
+
|
27
|
+
def initialize(env)
|
28
|
+
self.repo_slug = self.class.extract_repo_slug(env)
|
29
|
+
self.pull_request_id = env["CODEBUILD_SOURCE_VERSION"].split("/")[1]
|
30
|
+
self.repo_url = self.class.extract_repo_url(env)
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
def self.extract_repo_slug(env)
|
35
|
+
return nil unless env.key? "CODEBUILD_SOURCE_REPO_URL"
|
36
|
+
|
37
|
+
env["CODEBUILD_SOURCE_REPO_URL"].gsub(/^.*?github\.com\/(.*?)\.git$/, '\1')
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.extract_repo_url(env)
|
41
|
+
return nil unless env.key? "CODEBUILD_SOURCE_REPO_URL"
|
42
|
+
|
43
|
+
env["CODEBUILD_SOURCE_REPO_URL"].gsub(/\.git$/, "")
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.extract_pr_url(env)
|
47
|
+
return nil unless env.key? "CODEBUILD_SOURCE_VERSION"
|
48
|
+
return nil unless env.key? "CODEBUILD_SOURCE_REPO_URL"
|
49
|
+
return nil unless env["CODEBUILD_SOURCE_VERSION"].split("/").length == 2
|
50
|
+
|
51
|
+
source_origin, pr_number = env["CODEBUILD_SOURCE_VERSION"].split("/")
|
52
|
+
github_repo_url = env["CODEBUILD_SOURCE_REPO_URL"].gsub(/\.git$/, "")
|
53
|
+
|
54
|
+
"#{github_repo_url}/pull/#{pr_number}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/danger/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.7.
|
4
|
+
version: 5.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Orta Therox
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-10-
|
12
|
+
date: 2018-10-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: claide
|
@@ -185,6 +185,7 @@ files:
|
|
185
185
|
- lib/danger/ci_source/ci_source.rb
|
186
186
|
- lib/danger/ci_source/circle.rb
|
187
187
|
- lib/danger/ci_source/circle_api.rb
|
188
|
+
- lib/danger/ci_source/code_build.rb
|
188
189
|
- lib/danger/ci_source/codeship.rb
|
189
190
|
- lib/danger/ci_source/dotci.rb
|
190
191
|
- lib/danger/ci_source/drone.rb
|