danger 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: 9a534e4b3084cff5f94432c123204a9fac9a4859
4
- data.tar.gz: dc850675fbd49a0059842c2c5af8fff5c3dbb110
3
+ metadata.gz: 2b3337b2e55d499b082ba5f7aed4f5216e95349c
4
+ data.tar.gz: c1bfe7f5a5de81631266d4afa0d82ca8d8f8b31d
5
5
  SHA512:
6
- metadata.gz: 29f4abd20107421d94ff5b0159aceedd2aeb35b940ec11c2deab97c255b5bab22e80c42e1c01954cab01bd8a36ecb3492a5c79c101af10b0f46733fad2a2ccd4
7
- data.tar.gz: c2840f76f6961a600a9a2b98b7603ee3fa0fbfaf83f43dbee57f0f7c5fa20f603849429d34a9a12baa9f9ad593765f7793651fc6febcb4754609156cca8ec328
6
+ metadata.gz: 5ab6e3ef7b0db9db6032a2dbaea15d41ea56c7fdbc552677298cbd9c6587bb99346ad022b494f07917059a024252d785eff6ed0a821412c480f47bd715fb7c32
7
+ data.tar.gz: 714c8816a1fe0c8965460266f129589a8064b57dd0c601ed8b91f312a92e0e6bde6d522aa14f135efc2cc33e96047201aa1e36d2115f4a7bb34a77679c3424d0
@@ -50,9 +50,16 @@ module Danger
50
50
  # Just remove the comment, if there's nothing to say.
51
51
  delete_old_comments!
52
52
  else
53
+ issues = client.issue_comments(ci_source.repo_slug, ci_source.pull_request_id)
54
+ editable_issues = issues.reject { |issue| issue[:body].include?("generated_by_danger") == false }
53
55
  body = generate_comment(warnings: warnings, errors: errors, messages: messages)
54
- comment_result = client.add_comment(ci_source.repo_slug, ci_source.pull_request_id, body)
55
- delete_old_comments!(except: comment_result[:id])
56
+
57
+ if editable_issues.empty?
58
+ comment_result = client.add_comment(ci_source.repo_slug, ci_source.pull_request_id, body)
59
+ else
60
+ original_id = editable_issues.first[:id]
61
+ comment_result = client.update_comment(ci_source.repo_slug, original_id, body)
62
+ end
56
63
  end
57
64
 
58
65
  # Now, set the pull request status.
@@ -106,7 +113,7 @@ module Danger
106
113
  end
107
114
  end
108
115
 
109
- def generate_comment(warnings: nil, errors: nil, messages: nil)
116
+ def generate_comment(warnings: [], errors: [], messages: [])
110
117
  require 'erb'
111
118
 
112
119
  md_template = File.join(Danger.gem_path, "lib/danger/comment_generators/github.md.erb")
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  DESCRIPTION = "Ensure your pull request is up to standard with a nice DSL"
4
4
  end
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: 0.2.0
4
+ version: 0.2.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-01-13 00:00:00.000000000 Z
12
+ date: 2016-01-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide
@@ -215,9 +215,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
215
  version: '0'
216
216
  requirements: []
217
217
  rubyforge_project:
218
- rubygems_version: 2.4.0
218
+ rubygems_version: 2.4.6
219
219
  signing_key:
220
220
  specification_version: 4
221
221
  summary: Ensure your pull request is up to standard with a nice DSL
222
222
  test_files: []
223
- has_rdoc: