danger 3.3.0 → 3.3.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/bitrise.rb +2 -0
- data/lib/danger/ci_source/buildkite.rb +2 -0
- data/lib/danger/ci_source/circle.rb +1 -0
- data/lib/danger/ci_source/drone.rb +2 -0
- data/lib/danger/ci_source/gitlab_ci.rb +1 -0
- data/lib/danger/ci_source/jenkins.rb +12 -1
- data/lib/danger/ci_source/local_git_repo.rb +24 -31
- data/lib/danger/ci_source/semaphore.rb +1 -0
- data/lib/danger/ci_source/support/merged_pull_request_finder.rb +66 -0
- data/lib/danger/ci_source/support/remote_finder.rb +26 -0
- data/lib/danger/ci_source/surf.rb +1 -0
- data/lib/danger/ci_source/teamcity.rb +2 -0
- data/lib/danger/ci_source/travis.rb +1 -0
- data/lib/danger/ci_source/xcode_server.rb +1 -0
- data/lib/danger/danger_core/environment_manager.rb +2 -2
- data/lib/danger/danger_core/executor.rb +12 -5
- data/lib/danger/danger_core/plugins/dangerfile_github_plugin.rb +9 -9
- data/lib/danger/helpers/comment.rb +1 -1
- data/lib/danger/{request_source → request_sources}/bitbucket_cloud.rb +0 -0
- data/lib/danger/{request_source → request_sources}/bitbucket_cloud_api.rb +0 -0
- data/lib/danger/{request_source → request_sources}/bitbucket_server.rb +0 -0
- data/lib/danger/{request_source → request_sources}/bitbucket_server_api.rb +0 -0
- data/lib/danger/{request_source → request_sources}/github.rb +25 -26
- data/lib/danger/{request_source → request_sources}/gitlab.rb +0 -0
- data/lib/danger/{request_source → request_sources}/request_source.rb +0 -0
- data/lib/danger/version.rb +1 -1
- metadata +25 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c097c9080ca08cc97450e41454aea6db1634169
|
4
|
+
data.tar.gz: b7c32ddada66f84e92260dd1290e81f8e6619faf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a20361f8bfd84a9ee0b4864b5379ea6e2c546d6757f237790c9a1246c0a1236f38173c72e46ba8ff2d239c03c228605f73aa62396d84a7dbe7357d9a9f8897ce
|
7
|
+
data.tar.gz: f869abaa8c464b490a475f3d61908e5fbad1e857270639c2fe29dbbbab510b67da2c27c544761c33e889bbff9e90a21362396fe991930fd4c9d30771bf0d9050
|
@@ -1,5 +1,9 @@
|
|
1
1
|
# https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables
|
2
2
|
# https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin
|
3
|
+
require "danger/request_sources/github"
|
4
|
+
require "danger/request_sources/gitlab"
|
5
|
+
require "danger/request_sources/bitbucket_server"
|
6
|
+
require "danger/request_sources/bitbucket_cloud"
|
3
7
|
|
4
8
|
module Danger
|
5
9
|
# https://jenkins-ci.org
|
@@ -38,7 +42,14 @@ module Danger
|
|
38
42
|
end
|
39
43
|
|
40
44
|
def supported_request_sources
|
41
|
-
@supported_request_sources ||=
|
45
|
+
@supported_request_sources ||= begin
|
46
|
+
[
|
47
|
+
Danger::RequestSources::GitHub,
|
48
|
+
Danger::RequestSources::GitLab,
|
49
|
+
Danger::RequestSources::BitbucketServer,
|
50
|
+
Danger::RequestSources::BitbucketCloud
|
51
|
+
]
|
52
|
+
end
|
42
53
|
end
|
43
54
|
|
44
55
|
def initialize(env)
|
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
require "git"
|
4
4
|
require "uri"
|
5
|
+
require "danger/ci_source/support/remote_finder"
|
6
|
+
require "danger/ci_source/support/merged_pull_request_finder"
|
7
|
+
require "danger/request_sources/github"
|
5
8
|
|
6
9
|
module Danger
|
7
10
|
# ignore
|
@@ -28,39 +31,29 @@ module Danger
|
|
28
31
|
@supported_request_sources ||= [Danger::RequestSources::GitHub]
|
29
32
|
end
|
30
33
|
|
31
|
-
def
|
32
|
-
|
33
|
-
|
34
|
-
# get the remote URL
|
35
|
-
remote = run_git("remote show origin -n").lines.grep(/Fetch URL/)[0].split(": ", 2)[1]
|
36
|
-
if remote
|
37
|
-
remote_url_matches = remote.match(%r{#{Regexp.escape github_host}(:|/)(?<repo_slug>.+/.+?)(?:\.git)?$})
|
38
|
-
if !remote_url_matches.nil? and remote_url_matches["repo_slug"]
|
39
|
-
self.repo_slug = remote_url_matches["repo_slug"]
|
40
|
-
else
|
41
|
-
puts "Danger local requires a repository hosted on GitHub.com or GitHub Enterprise."
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
specific_pr = env["LOCAL_GIT_PR_ID"]
|
46
|
-
pr_ref = specific_pr ? "##{specific_pr}" : ""
|
47
|
-
pr_command = "log --merges --oneline"
|
34
|
+
def print_repo_slug_warning
|
35
|
+
puts "Danger local requires a repository hosted on GitHub.com or GitHub Enterprise.".freeze
|
36
|
+
end
|
48
37
|
|
49
|
-
|
50
|
-
|
38
|
+
def parents(sha)
|
39
|
+
@parents ||= run_git("rev-list --parents -n 1 #{sha}").strip.split(" ".freeze)
|
40
|
+
end
|
51
41
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
self.
|
42
|
+
def initialize(env = {})
|
43
|
+
repo_slug = RemoteFinder.new(
|
44
|
+
env["DANGER_GITHUB_HOST"] || "github.com".freeze,
|
45
|
+
run_git("remote show origin -n".freeze)
|
46
|
+
).call
|
47
|
+
|
48
|
+
pull_request_id, sha = MergedPullRequestFinder.new(
|
49
|
+
env["LOCAL_GIT_PR_ID"] || "",
|
50
|
+
run_git("log --oneline -50".freeze)
|
51
|
+
).call
|
52
|
+
|
53
|
+
self.repo_slug = repo_slug ? repo_slug : print_repo_slug_warning
|
54
|
+
self.pull_request_id = pull_request_id
|
55
|
+
self.base_commit = parents(sha)[0]
|
56
|
+
self.head_commit = parents(sha)[1]
|
64
57
|
end
|
65
58
|
end
|
66
59
|
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Danger
|
2
|
+
class MergedPullRequestFinder
|
3
|
+
def initialize(specific_pull_request_id, git_logs)
|
4
|
+
@specific_pull_request_id = specific_pull_request_id
|
5
|
+
@git_logs = git_logs
|
6
|
+
end
|
7
|
+
|
8
|
+
def call
|
9
|
+
check_if_any_merged_pull_request!
|
10
|
+
|
11
|
+
[merged_pull_request_id, merged_pull_request_sha]
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
attr_reader :specific_pull_request_id, :git_logs
|
17
|
+
|
18
|
+
# @return [String] "#42"
|
19
|
+
def pull_request_ref
|
20
|
+
specific_pull_request_id ? "##{specific_pull_request_id}" : "".freeze
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [String] Log line of format: "Merge pull request #42"
|
24
|
+
def most_recent_merged_pull_request
|
25
|
+
@most_recent_merged_pull_request ||= begin
|
26
|
+
git_logs.lines.grep(/Merge pull request #{pull_request_ref}/)[0]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# @return [String] Log line of format: "description (#42)"
|
31
|
+
def most_recent_squash_and_merged_pull_request
|
32
|
+
@most_recent_squash_and_merged_pull_request ||= begin
|
33
|
+
git_logs.lines.grep(/#{pull_request_ref}/)[0]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# @return [String] Log line of most recent merged Pull Request
|
38
|
+
def merged_pull_request
|
39
|
+
return if pull_request_ref.empty?
|
40
|
+
|
41
|
+
if most_recent_merged_pull_request
|
42
|
+
most_recent_merged_pull_request
|
43
|
+
elsif most_recent_squash_and_merged_pull_request
|
44
|
+
most_recent_squash_and_merged_pull_request
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def check_if_any_merged_pull_request!
|
49
|
+
if merged_pull_request.to_s.empty?
|
50
|
+
if specific_pull_request_id
|
51
|
+
raise "Could not find the Pull Request (#{specific_pull_request_id}) inside the git history for this repo."
|
52
|
+
else
|
53
|
+
raise "No recent Pull Requests found for this repo, danger requires at least one Pull Request for the local mode.".freeze
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def merged_pull_request_id
|
59
|
+
merged_pull_request.match(/#(?<id>[0-9]+)/)[:id]
|
60
|
+
end
|
61
|
+
|
62
|
+
def merged_pull_request_sha
|
63
|
+
merged_pull_request.split(" ".freeze).first
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Danger
|
2
|
+
class RemoteFinder
|
3
|
+
def initialize(github_host, remote_logs)
|
4
|
+
@github_host = github_host
|
5
|
+
@remote_logs = remote_logs
|
6
|
+
end
|
7
|
+
|
8
|
+
def call
|
9
|
+
remote_url_matches && remote_url_matches["repo_slug"]
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
attr_reader :remote_logs, :github_host
|
15
|
+
|
16
|
+
# @return [String] The remote URL
|
17
|
+
def remote
|
18
|
+
@remote ||= remote_logs.lines.grep(/Fetch URL/)[0].split(": ".freeze, 2)[1]
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [nil / MatchData] MatchData object or nil if not matched
|
22
|
+
def remote_url_matches
|
23
|
+
remote.match(%r{#{Regexp.escape github_host}(:|/)(?<repo_slug>.+/.+?)(?:\.git)?$})
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require "danger/ci_source/ci_source"
|
2
|
-
require "danger/
|
2
|
+
require "danger/request_sources/request_source"
|
3
3
|
|
4
4
|
module Danger
|
5
5
|
class EnvironmentManager
|
@@ -28,7 +28,7 @@ module Danger
|
|
28
28
|
self.request_source = request_source
|
29
29
|
end
|
30
30
|
|
31
|
-
raise "Could not find a Request Source for #{ci_klass}".red unless self.request_source
|
31
|
+
raise "Could not find a Request Source for #{ci_klass}\nCI: #{ci_source.inspect}".red unless self.request_source
|
32
32
|
self.scm = self.request_source.scm
|
33
33
|
end
|
34
34
|
|
@@ -40,6 +40,7 @@ module Danger
|
|
40
40
|
# Offer the chance for a user to specify a branch through the command line
|
41
41
|
ci_base = base || EnvironmentManager.danger_base_branch
|
42
42
|
ci_head = head || EnvironmentManager.danger_head_branch
|
43
|
+
|
43
44
|
dm.env.scm.diff_for_folder(".", from: ci_base, to: ci_head)
|
44
45
|
|
45
46
|
# Parse the local Dangerfile
|
@@ -52,12 +53,18 @@ module Danger
|
|
52
53
|
end
|
53
54
|
end
|
54
55
|
|
55
|
-
def post_results(
|
56
|
-
|
57
|
-
violations =
|
58
|
-
status =
|
56
|
+
def post_results(danger_file, danger_id)
|
57
|
+
request_source = danger_file.env.request_source
|
58
|
+
violations = danger_file.violation_report
|
59
|
+
status = danger_file.status_report
|
59
60
|
|
60
|
-
|
61
|
+
request_source.update_pull_request!(
|
62
|
+
warnings: violations[:warnings],
|
63
|
+
errors: violations[:errors],
|
64
|
+
messages: violations[:messages],
|
65
|
+
markdowns: status[:markdowns],
|
66
|
+
danger_id: danger_id
|
67
|
+
)
|
61
68
|
end
|
62
69
|
end
|
63
70
|
end
|
@@ -97,7 +97,7 @@ module Danger
|
|
97
97
|
# @return [String]
|
98
98
|
#
|
99
99
|
def pr_title
|
100
|
-
@github.pr_json[
|
100
|
+
@github.pr_json["title"].to_s
|
101
101
|
end
|
102
102
|
|
103
103
|
# @!group PR Metadata
|
@@ -105,7 +105,7 @@ module Danger
|
|
105
105
|
# @return [String]
|
106
106
|
#
|
107
107
|
def pr_body
|
108
|
-
pr_json[
|
108
|
+
pr_json["body"].to_s
|
109
109
|
end
|
110
110
|
|
111
111
|
# @!group PR Metadata
|
@@ -113,7 +113,7 @@ module Danger
|
|
113
113
|
# @return [String]
|
114
114
|
#
|
115
115
|
def pr_author
|
116
|
-
pr_json[
|
116
|
+
pr_json["user"]["login"].to_s
|
117
117
|
end
|
118
118
|
|
119
119
|
# @!group PR Metadata
|
@@ -121,7 +121,7 @@ module Danger
|
|
121
121
|
# @return [String]
|
122
122
|
#
|
123
123
|
def pr_labels
|
124
|
-
@github.issue_json[
|
124
|
+
@github.issue_json["labels"].map { |l| l[:name] }
|
125
125
|
end
|
126
126
|
|
127
127
|
# @!group PR Commit Metadata
|
@@ -129,7 +129,7 @@ module Danger
|
|
129
129
|
# @return [String]
|
130
130
|
#
|
131
131
|
def branch_for_base
|
132
|
-
pr_json[
|
132
|
+
pr_json["base"]["ref"]
|
133
133
|
end
|
134
134
|
|
135
135
|
# @!group PR Commit Metadata
|
@@ -137,7 +137,7 @@ module Danger
|
|
137
137
|
# @return [String]
|
138
138
|
#
|
139
139
|
def branch_for_head
|
140
|
-
pr_json[
|
140
|
+
pr_json["head"]["ref"]
|
141
141
|
end
|
142
142
|
|
143
143
|
# @!group PR Commit Metadata
|
@@ -145,7 +145,7 @@ module Danger
|
|
145
145
|
# @return [String]
|
146
146
|
#
|
147
147
|
def base_commit
|
148
|
-
pr_json[
|
148
|
+
pr_json["base"]["sha"]
|
149
149
|
end
|
150
150
|
|
151
151
|
# @!group PR Commit Metadata
|
@@ -153,7 +153,7 @@ module Danger
|
|
153
153
|
# @return [String]
|
154
154
|
#
|
155
155
|
def head_commit
|
156
|
-
pr_json[
|
156
|
+
pr_json["head"]["sha"]
|
157
157
|
end
|
158
158
|
|
159
159
|
# @!group GitHub Misc
|
@@ -193,7 +193,7 @@ module Danger
|
|
193
193
|
def html_link(paths, full_path: true)
|
194
194
|
paths = [paths] unless paths.kind_of?(Array)
|
195
195
|
commit = head_commit
|
196
|
-
repo = pr_json[
|
196
|
+
repo = pr_json["head"]["repo"]["html_url"]
|
197
197
|
|
198
198
|
paths = paths.map do |path|
|
199
199
|
url_path = path.start_with?("/") ? path : "/#{path}"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -52,8 +52,8 @@ module Danger
|
|
52
52
|
|
53
53
|
def setup_danger_branches
|
54
54
|
# we can use a github specific feature here:
|
55
|
-
base_commit = self.pr_json[
|
56
|
-
head_commit = self.pr_json[
|
55
|
+
base_commit = self.pr_json["base"]["sha"]
|
56
|
+
head_commit = self.pr_json["head"]["sha"]
|
57
57
|
|
58
58
|
# Next, we want to ensure that we have a version of the current branch at a known location
|
59
59
|
self.scm.exec "branch #{EnvironmentManager.danger_base_branch} #{base_commit}"
|
@@ -65,7 +65,7 @@ module Danger
|
|
65
65
|
|
66
66
|
def fetch_details
|
67
67
|
self.pr_json = client.pull_request(ci_source.repo_slug, ci_source.pull_request_id)
|
68
|
-
if self.pr_json[
|
68
|
+
if self.pr_json["message"] == "Moved Permanently"
|
69
69
|
raise "Repo moved or renamed, make sure to update the git remote".red
|
70
70
|
end
|
71
71
|
|
@@ -74,13 +74,13 @@ module Danger
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def ignored_violations_from_pr(pr_json)
|
77
|
-
pr_body = pr_json[
|
77
|
+
pr_body = pr_json["body"]
|
78
78
|
return [] if pr_body.nil?
|
79
79
|
pr_body.chomp.scan(/>\s*danger\s*:\s*ignore\s*"(.*)"/i).flatten
|
80
80
|
end
|
81
81
|
|
82
82
|
def fetch_issue_details(pr_json)
|
83
|
-
href = pr_json[
|
83
|
+
href = pr_json["_links"]["issue"]["href"]
|
84
84
|
self.issue_json = client.get(href)
|
85
85
|
end
|
86
86
|
|
@@ -151,14 +151,13 @@ module Danger
|
|
151
151
|
# Note: this can terminate the entire process.
|
152
152
|
submit_pull_request_status!(warnings: warnings,
|
153
153
|
errors: errors,
|
154
|
-
details_url: comment_result[
|
154
|
+
details_url: comment_result["html_url"])
|
155
155
|
end
|
156
156
|
|
157
157
|
def submit_pull_request_status!(warnings: [], errors: [], details_url: [])
|
158
158
|
status = (errors.count.zero? ? "success" : "failure")
|
159
159
|
message = generate_description(warnings: warnings, errors: errors)
|
160
|
-
|
161
|
-
latest_pr_commit_ref = self.pr_json[:head][:sha]
|
160
|
+
latest_pr_commit_ref = self.pr_json["head"]["sha"]
|
162
161
|
|
163
162
|
if latest_pr_commit_ref.empty? || latest_pr_commit_ref.nil?
|
164
163
|
raise "Couldn't find a commit to update its status".red
|
@@ -176,7 +175,7 @@ module Danger
|
|
176
175
|
# use a read-only GitHub account
|
177
176
|
if errors.count > 0
|
178
177
|
# We need to fail the actual build here
|
179
|
-
is_private = pr_json[
|
178
|
+
is_private = pr_json["base"]["repo"]["private"]
|
180
179
|
if is_private
|
181
180
|
abort("\nDanger has failed this build. \nFound #{'error'.danger_pluralize(errors.count)} and I don't have write access to the PR to set a PR status.")
|
182
181
|
else
|
@@ -203,32 +202,32 @@ module Danger
|
|
203
202
|
|
204
203
|
diff_lines = self.pr_diff.lines
|
205
204
|
pr_comments = client.pull_request_comments(ci_source.repo_slug, ci_source.pull_request_id)
|
206
|
-
danger_comments = pr_comments.select { |comment| comment[
|
205
|
+
danger_comments = pr_comments.select { |comment| comment["body"].include?("generated_by_#{danger_id}") }
|
207
206
|
non_danger_comments = pr_comments - danger_comments
|
208
207
|
|
209
|
-
submit_inline_comments_for_kind!("warning", warnings, diff_lines, danger_comments, previous_violations[
|
210
|
-
submit_inline_comments_for_kind!("no_entry_sign", errors, diff_lines, danger_comments, previous_violations[
|
211
|
-
submit_inline_comments_for_kind!("book", messages, diff_lines, danger_comments, previous_violations[
|
208
|
+
submit_inline_comments_for_kind!("warning", warnings, diff_lines, danger_comments, previous_violations["warning"], danger_id: danger_id)
|
209
|
+
submit_inline_comments_for_kind!("no_entry_sign", errors, diff_lines, danger_comments, previous_violations["error"], danger_id: danger_id)
|
210
|
+
submit_inline_comments_for_kind!("book", messages, diff_lines, danger_comments, previous_violations["message"], danger_id: danger_id)
|
212
211
|
submit_inline_comments_for_kind!(nil, markdowns, diff_lines, danger_comments, [], danger_id: danger_id)
|
213
212
|
|
214
213
|
# submit removes from the array all comments that are still in force
|
215
214
|
# so we strike out all remaining ones
|
216
215
|
danger_comments.each do |comment|
|
217
|
-
violation = violations_from_table(comment[
|
216
|
+
violation = violations_from_table(comment["body"]).first
|
218
217
|
if !violation.nil? && violation.sticky
|
219
218
|
body = generate_inline_comment_body("white_check_mark", violation, danger_id: danger_id, resolved: true, template: "github")
|
220
|
-
client.update_pull_request_comment(ci_source.repo_slug, comment[
|
219
|
+
client.update_pull_request_comment(ci_source.repo_slug, comment["id"], body)
|
221
220
|
else
|
222
221
|
# We remove non-sticky violations that have no replies
|
223
222
|
# Since there's no direct concept of a reply in GH, we simply consider
|
224
223
|
# the existance of non-danger comments in that line as replies
|
225
224
|
replies = non_danger_comments.select do |potential|
|
226
|
-
potential[
|
227
|
-
potential[
|
228
|
-
potential[
|
225
|
+
potential["path"] == comment["path"] &&
|
226
|
+
potential["position"] == comment["position"] &&
|
227
|
+
potential["commit_id"] == comment["commit_id"]
|
229
228
|
end
|
230
229
|
|
231
|
-
client.delete_pull_request_comment(ci_source.repo_slug, comment[
|
230
|
+
client.delete_pull_request_comment(ci_source.repo_slug, comment["id"]) if replies.empty?
|
232
231
|
end
|
233
232
|
end
|
234
233
|
end
|
@@ -240,7 +239,7 @@ module Danger
|
|
240
239
|
end
|
241
240
|
|
242
241
|
def submit_inline_comments_for_kind!(emoji, messages, diff_lines, danger_comments, previous_violations, danger_id: "danger")
|
243
|
-
head_ref = pr_json[
|
242
|
+
head_ref = pr_json["head"]["sha"]
|
244
243
|
previous_violations ||= []
|
245
244
|
is_markdown_content = emoji.nil?
|
246
245
|
|
@@ -265,13 +264,13 @@ module Danger
|
|
265
264
|
end
|
266
265
|
|
267
266
|
matching_comments = danger_comments.select do |comment_data|
|
268
|
-
if comment_data[
|
267
|
+
if comment_data["path"] == m.file && comment_data["commit_id"] == head_ref && comment_data["position"] == position
|
269
268
|
# Parse it to avoid problems with strikethrough
|
270
|
-
violation = violations_from_table(comment_data[
|
269
|
+
violation = violations_from_table(comment_data["body"]).first
|
271
270
|
if violation
|
272
271
|
messages_are_equivalent(violation, m)
|
273
272
|
else
|
274
|
-
comment_data[
|
273
|
+
comment_data["body"] == body
|
275
274
|
end
|
276
275
|
else
|
277
276
|
false
|
@@ -287,7 +286,7 @@ module Danger
|
|
287
286
|
|
288
287
|
# Update the comment to remove the strikethrough if present
|
289
288
|
comment = matching_comments.first
|
290
|
-
client.update_pull_request_comment(ci_source.repo_slug, comment[
|
289
|
+
client.update_pull_request_comment(ci_source.repo_slug, comment["id"], body)
|
291
290
|
end
|
292
291
|
|
293
292
|
# Remove this element from the array
|
@@ -360,7 +359,7 @@ module Danger
|
|
360
359
|
end
|
361
360
|
|
362
361
|
def markdown_link_to_message(message, hide_link)
|
363
|
-
url = "https://github.com/#{ci_source.repo_slug}/blob/#{pr_json[
|
362
|
+
url = "https://github.com/#{ci_source.repo_slug}/blob/#{pr_json['head']['sha']}/#{message.file}#L#{message.line}"
|
364
363
|
|
365
364
|
if hide_link
|
366
365
|
"<span data-href=\"#{url}\"/>"
|
@@ -371,7 +370,7 @@ module Danger
|
|
371
370
|
|
372
371
|
# @return [String] The organisation name, is nil if it can't be detected
|
373
372
|
def organisation
|
374
|
-
matched = self.issue_json[
|
373
|
+
matched = self.issue_json["repository_url"].match(%r{repos\/(.*)\/})
|
375
374
|
return matched[1] if matched && matched[1]
|
376
375
|
rescue
|
377
376
|
nil
|
File without changes
|
File without changes
|
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: 3.3.
|
4
|
+
version: 3.3.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: 2016-09-
|
12
|
+
date: 2016-09-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: claide
|
@@ -249,6 +249,20 @@ dependencies:
|
|
249
249
|
- - "~>"
|
250
250
|
- !ruby/object:Gem::Version
|
251
251
|
version: '0.10'
|
252
|
+
- !ruby/object:Gem::Dependency
|
253
|
+
name: pry-byebug
|
254
|
+
requirement: !ruby/object:Gem::Requirement
|
255
|
+
requirements:
|
256
|
+
- - ">="
|
257
|
+
- !ruby/object:Gem::Version
|
258
|
+
version: '0'
|
259
|
+
type: :development
|
260
|
+
prerelease: false
|
261
|
+
version_requirements: !ruby/object:Gem::Requirement
|
262
|
+
requirements:
|
263
|
+
- - ">="
|
264
|
+
- !ruby/object:Gem::Version
|
265
|
+
version: '0'
|
252
266
|
- !ruby/object:Gem::Dependency
|
253
267
|
name: rubocop
|
254
268
|
requirement: !ruby/object:Gem::Requirement
|
@@ -372,6 +386,8 @@ files:
|
|
372
386
|
- lib/danger/ci_source/jenkins.rb
|
373
387
|
- lib/danger/ci_source/local_git_repo.rb
|
374
388
|
- lib/danger/ci_source/semaphore.rb
|
389
|
+
- lib/danger/ci_source/support/merged_pull_request_finder.rb
|
390
|
+
- lib/danger/ci_source/support/remote_finder.rb
|
375
391
|
- lib/danger/ci_source/surf.rb
|
376
392
|
- lib/danger/ci_source/teamcity.rb
|
377
393
|
- lib/danger/ci_source/travis.rb
|
@@ -414,13 +430,13 @@ files:
|
|
414
430
|
- lib/danger/plugin_support/plugin_linter.rb
|
415
431
|
- lib/danger/plugin_support/plugin_parser.rb
|
416
432
|
- lib/danger/plugin_support/templates/readme_table.html.erb
|
417
|
-
- lib/danger/
|
418
|
-
- lib/danger/
|
419
|
-
- lib/danger/
|
420
|
-
- lib/danger/
|
421
|
-
- lib/danger/
|
422
|
-
- lib/danger/
|
423
|
-
- lib/danger/
|
433
|
+
- lib/danger/request_sources/bitbucket_cloud.rb
|
434
|
+
- lib/danger/request_sources/bitbucket_cloud_api.rb
|
435
|
+
- lib/danger/request_sources/bitbucket_server.rb
|
436
|
+
- lib/danger/request_sources/bitbucket_server_api.rb
|
437
|
+
- lib/danger/request_sources/github.rb
|
438
|
+
- lib/danger/request_sources/gitlab.rb
|
439
|
+
- lib/danger/request_sources/request_source.rb
|
424
440
|
- lib/danger/scm_source/git_repo.rb
|
425
441
|
- lib/danger/version.rb
|
426
442
|
homepage: https://github.com/danger/danger
|