danger 8.0.2 → 8.0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f89ff08f152cedf23e9fcb48adc8b256ddb1ef8992c682bb6ad6ef1620ba1f5f
|
4
|
+
data.tar.gz: d9f689cd3b403177e3475d364f2aebe5b49a78e72eebfaeab49fad8d6ec3f619
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b1db5d7f0ed5106614a967c5bd45cdb8b896327f29512d259f662c0ad994438bb2c9240c122aab93f228eb21bf2f80029d6cf851d7f315f7559e491aa60cb04
|
7
|
+
data.tar.gz: 51413afca0478a350693672cb831e67e5ed92ff5a6d026caa805bdb58ff09bf7b8bfbbdd5cfc16c83878d8164af26088036fbc5aa354d57c990c75dcb15f8f6f
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# http://docs.gitlab.com/ce/ci/variables/README.html
|
2
2
|
require "uri"
|
3
|
+
require "danger/request_sources/github/github"
|
3
4
|
require "danger/request_sources/gitlab"
|
4
5
|
|
5
6
|
module Danger
|
@@ -15,10 +16,13 @@ module Danger
|
|
15
16
|
# ```
|
16
17
|
# ### Token Setup
|
17
18
|
#
|
18
|
-
# Add the `DANGER_GITLAB_API_TOKEN` to your pipeline env variables
|
19
|
-
|
20
|
-
|
19
|
+
# Add the `DANGER_GITLAB_API_TOKEN` to your pipeline env variables if you
|
20
|
+
# are hosting your code on GitLab. If you are using GitLab as a mirror
|
21
|
+
# for the purpose of CI/CD, while hosting your repo on GitHub, set the
|
22
|
+
# `DANGER_GITHUB_API_TOKEN` as well as the project repo URL to
|
23
|
+
# `DANGER_PROJECT_REPO_URL`.
|
21
24
|
|
25
|
+
class GitLabCI < CI
|
22
26
|
def self.validates_as_ci?(env)
|
23
27
|
env.key? "GITLAB_CI"
|
24
28
|
end
|
@@ -28,11 +32,12 @@ module Danger
|
|
28
32
|
"GITLAB_CI", "CI_PROJECT_PATH"
|
29
33
|
].all? { |x| env[x] }
|
30
34
|
|
31
|
-
exists &&
|
35
|
+
exists && determine_pull_or_merge_request_id(env).to_i > 0
|
32
36
|
end
|
33
37
|
|
34
|
-
def self.
|
38
|
+
def self.determine_pull_or_merge_request_id(env)
|
35
39
|
return env["CI_MERGE_REQUEST_IID"] if env["CI_MERGE_REQUEST_IID"]
|
40
|
+
return env["CI_EXTERNAL_PULL_REQUEST_IID"] if env["CI_EXTERNAL_PULL_REQUEST_IID"]
|
36
41
|
return 0 unless env["CI_COMMIT_SHA"]
|
37
42
|
|
38
43
|
project_path = env["CI_MERGE_REQUEST_PROJECT_PATH"] || env["CI_PROJECT_PATH"]
|
@@ -54,16 +59,28 @@ module Danger
|
|
54
59
|
|
55
60
|
def initialize(env)
|
56
61
|
@env = env
|
57
|
-
@repo_slug = env
|
58
|
-
@project_url = env["CI_MERGE_REQUEST_PROJECT_URL"] || env["CI_PROJECT_URL"]
|
62
|
+
@repo_slug = slug_from(env)
|
59
63
|
end
|
60
64
|
|
61
65
|
def supported_request_sources
|
62
|
-
@supported_request_sources ||= [
|
66
|
+
@supported_request_sources ||= [
|
67
|
+
Danger::RequestSources::GitHub,
|
68
|
+
Danger::RequestSources::GitLab
|
69
|
+
]
|
63
70
|
end
|
64
71
|
|
65
72
|
def pull_request_id
|
66
|
-
@pull_request_id ||= self.class.
|
73
|
+
@pull_request_id ||= self.class.determine_pull_or_merge_request_id(@env)
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def slug_from(env)
|
79
|
+
if env["DANGER_PROJECT_REPO_URL"]
|
80
|
+
env["DANGER_PROJECT_REPO_URL"].split('/').last(2).join('/')
|
81
|
+
else
|
82
|
+
env["CI_MERGE_REQUEST_PROJECT_PATH"] || env["CI_PROJECT_PATH"]
|
83
|
+
end
|
67
84
|
end
|
68
85
|
end
|
69
86
|
end
|
@@ -135,7 +135,7 @@ module Danger
|
|
135
135
|
git_in_depth_fetch
|
136
136
|
possible_merge_base = possible_merge_base(repo, from, to)
|
137
137
|
|
138
|
-
raise "Cannot find a merge base between #{from} and #{to}." unless possible_merge_base
|
138
|
+
raise "Cannot find a merge base between #{from} and #{to}. If you are using shallow clone/fetch, try increasing the --depth" unless possible_merge_base
|
139
139
|
|
140
140
|
possible_merge_base
|
141
141
|
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: 8.0.
|
4
|
+
version: 8.0.3
|
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: 2020-
|
12
|
+
date: 2020-07-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: claide
|