pullermann 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/pullermann/pullermann.rb +15 -3
  2. metadata +1 -1
@@ -133,8 +133,11 @@ class Pullermann
133
133
  end
134
134
  # If it's not mergeable, we need to delete all comments of former test runs.
135
135
  unless pull_request.mergeable
136
- @log.info 'Pull request not auto-mergeable, skipping... '
137
- call_github(old_comment_success?).delete_comment(@project, @comment.id) if @comment
136
+ @log.info 'Pull request not auto-mergeable. Not running tests.'
137
+ if @comment
138
+ @log.info 'Deleting existing comment.'
139
+ call_github(old_comment_success?).delete_comment(@project, @comment.id)
140
+ end
138
141
  return false
139
142
  end
140
143
  if @comment
@@ -187,22 +190,31 @@ class Pullermann
187
190
  def comment_on_github
188
191
  # Determine comment message.
189
192
  message = if @test_success
193
+ @log.info 'Tests are passing.'
190
194
  'Well done! All tests are still passing after merging this pull request.'
191
195
  else
196
+ @log.info 'Tests are failing.'
192
197
  'Unfortunately your tests are failing after merging this pull request.'
193
198
  end
194
199
  message += "\n( master sha# #{@target_head_sha} ; pull sha# #{@pull_head_sha} )"
195
200
  if old_comment_success? == @test_success
196
201
  # Replace existing @comment's body with the correct connection.
202
+ @log.info "Updating existing #{notion(@test_success)} comment."
197
203
  call_github(@test_success).update_comment(@project, @comment['id'], message)
198
204
  else
205
+ @log.info "Deleting existing #{notion(!@test_success)} comment."
199
206
  # Delete old @comment with correct connection (if @comment exists).
200
207
  call_github(!@test_success).delete_comment(@project, @comment['id']) if @comment
201
208
  # Create new comment with correct connection.
202
- call_github.add_comment(@project, @request_id, message)
209
+ @log.info "Adding new #{notion(@test_success)} comment."
210
+ call_github(@test_success).add_comment(@project, @request_id, message)
203
211
  end
204
212
  end
205
213
 
214
+ def notion(success)
215
+ success ? 'positive' : 'negative'
216
+ end
217
+
206
218
  # Determine which connection to GitHub should be used for the call.
207
219
  def call_github(use_default_user = true)
208
220
  use_default_user ? @github : @github_fail
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pullermann
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: