lita-github-pinger 0.5.5 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2aba1c6425304ecc11cc4e5ba5b481330bc9c829
4
- data.tar.gz: dbf7bb9c45d71d18e61f8d70519d55f4c7d11986
3
+ metadata.gz: f44cec44e12fb74dd6be99f474bb5f764f2b5f90
4
+ data.tar.gz: 322afdae8aad9ccb59680e3e84a21087e6163bca
5
5
  SHA512:
6
- metadata.gz: 0344655329ddd92e3b6984725e3ea6dab9ffa682d119bdfc488f47fd1a5cabfa77fd859053d17846c6403edc024ec296edae86df130129566472ca9bc47124b9
7
- data.tar.gz: e994e0a9c29224ab48230faefa2f5f489120d1e93d70d891a3dcfb849fce75b9ef0d953d97a3a761c6f0319475a2e1a5d1db094b32a4cb6ac7a012f9487a0abe
6
+ metadata.gz: 4e1cee8cfffa42750a6457abbabc3f4b15e5b67c3cd4082000874596385eee316263e941dba7ccdc7cb7b68062ea85ab5e93a8c8543b0f65a59d0b761978f2b0
7
+ data.tar.gz: 0da4ea3dc9d682d7401203b65d9d818eb5d72130331e2400700d822c893f349921ecef67493f1801445df70bd5b5cb8a4f1e9b19e823276e2971f946e2b59195
@@ -52,7 +52,41 @@ module Lita
52
52
  def travisping(request, response)
53
53
  puts "########## New Travis Event! ##########"
54
54
  body = MultiJson.load(request.body)
55
- p MultiJson.dump(body)
55
+
56
+ committer = find_engineer(name: body["matrix"]["author_name"])
57
+ build_status = body["status_message"]
58
+
59
+ if build_status == "Passed"
60
+ act_on_build_success(commiter, body)
61
+ elsif ["Broken", "Failed"].include?(build_status)
62
+ act_on_build_failure(commiter, body)
63
+ end
64
+ end
65
+
66
+ def act_on_build_failure(commiter, body)
67
+ pr_url = body["repository"]["url"] + "/pull/" + body["pull_request_number"]
68
+ build_url = body["build_url"]
69
+
70
+ puts "Detected that the travis build was for PR #{pr_url}"
71
+ message = ":x: Your pull request failed its travis build."
72
+ message += "#{pr_url}\n#{build_url}"
73
+
74
+ if commiter[:travis_preferences][:frequency] != "only_passes"
75
+ send_dm(commiter[:usernames][:slack], message)
76
+ end
77
+ end
78
+
79
+ def act_on_build_success(commiter, body)
80
+ pr_url = body["repository"]["url"] + "/pull/" + body["pull_request_number"]
81
+ build_url = body["build_url"]
82
+
83
+ puts "Detected that the travis build was for PR #{pr_url}"
84
+ message = ":white_check_mark: Your pull request has passed its travis build."
85
+ message += "#{pr_url}\n#{build_url}"
86
+
87
+ if commiter[:travis_preferences][:frequency] != "only_failures"
88
+ send_dm(commiter[:usernames][:slack], message)
89
+ end
56
90
  end
57
91
 
58
92
  def act_on_assign(body, response)
@@ -148,7 +182,11 @@ module Lita
148
182
  puts "Done."
149
183
  end
150
184
 
151
- def find_engineer(slack: nil, github: nil)
185
+ def find_engineer(slack: nil, github: nil, name: nil)
186
+ if name
187
+ return config.engineers[name]
188
+ end
189
+
152
190
  config.engineers.values.select do |eng|
153
191
  if slack
154
192
  eng[:usernames][:slack] == slack
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-github-pinger"
3
- spec.version = "0.5.5"
3
+ spec.version = "0.5.6"
4
4
  spec.authors = ["Taylor Lapeyre"]
5
5
  spec.email = ["taylorlapeyre@gmail.com"]
6
6
  spec.description = "A Lita handler that detects github comment notifications and regurgitates a ping to the correct slack username."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-github-pinger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Lapeyre