lita-github-pinger 0.5.7 → 0.5.8

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: 0771d4f83b1f8b359099c48a25a8742a4553a6a8
4
- data.tar.gz: 9ff3e9dfdd9a6d8c88125b47373360c904e1a188
3
+ metadata.gz: b594bf9b9431f0ad27149c953c92e38dddbf1f26
4
+ data.tar.gz: d78897eae20042b7b049f67e96d1f68af2bdf8a5
5
5
  SHA512:
6
- metadata.gz: 0145f4acd1855ddf11564e5bb330b5763e74eba6a5a6a7ff144109f3f65c4ffbfc714cfd6a7984b4886a9a418dc8889fdcb7894637a0e5d3e55968d2b7fe4997
7
- data.tar.gz: 68367a6cdeb56924894f084c20c36c41a702813207738124200bc09fba007de4db13916a9da74162c23a02cbc29e8f0fb86ef64a777ab4f83a4e0c735b30ac22
6
+ metadata.gz: b3bc94bb6a94c3e92a402aa473d70b9c963e5484af79a61e127ca8bd65db14576a854e39bfb5deba671d6db9093144d521609c67dbb8b1ccf903b1d6ee1ec72e
7
+ data.tar.gz: bae42cbe1d15873aa803031cfcd78ab2c017c0ca0b2f07329eea0a7c6af09a0ca5e780141036bf26cefc03ac59f21aee36869fd533c823c0624533b9c337da71
@@ -34,10 +34,9 @@ module Lita
34
34
  config :engineers, type: Hash, required: true
35
35
 
36
36
  http.post("/ghping", :ghping)
37
- http.post("/travisping", :travisping)
38
37
 
39
38
  def ghping(request, response)
40
- puts "########## New GH PR Event! ##########"
39
+ puts "########## New GitHub Event! ##########"
41
40
  body = MultiJson.load(request.body)
42
41
 
43
42
  if body["comment"]
@@ -47,46 +46,38 @@ module Lita
47
46
  if body["action"] && body["action"] == "assigned"
48
47
  act_on_assign(body, response)
49
48
  end
50
- end
51
-
52
- def travisping(request, response)
53
- puts "########## New Travis Event! ##########"
54
- body = MultiJson.load(request.body)
55
49
 
56
- committer = find_engineer(name: body["matrix"]["author_name"])
57
- build_status = body["status_message"]
50
+ if body["state"] && body["state"] == "success"
51
+ act_on_build_success(body, response)
52
+ end
58
53
 
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)
54
+ if body["state"] && body["state"] == "failure"
55
+ act_on_build_failure(body, response)
63
56
  end
64
57
  end
65
58
 
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"]
59
+ def act_on_build_failure(body, response)
60
+ commit_url = body["commit"]["html_url"]
61
+ committer = find_engineer(github: github["commit"]["committer"]["login"])
69
62
 
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}"
63
+ puts "Detected a travis build failure for commit #{body["sha"]}"
64
+ message = ":x: Your commit failed some tests."
65
+ message += "\n#{commit_url}"
73
66
 
74
- if commiter[:travis_preferences][:frequency] != "only_passes"
75
- send_dm(commiter[:usernames][:slack], message)
76
- end
67
+ return if ["off", "only_passes"].include?(commiter[:travis_preferences][:frequency])
68
+ send_dm(commiter[:usernames][:slack], message)
77
69
  end
78
70
 
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"]
71
+ def act_on_build_success(body, response)
72
+ commit_url = body["commit"]["html_url"]
73
+ committer = find_engineer(github: github["commit"]["committer"]["login"])
82
74
 
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}"
75
+ puts "Detected a travis build success for commit #{body["sha"]}"
76
+ message = ":white_check_mark: Your commit has passed its travis build."
77
+ message += "\n#{commit_url}"
86
78
 
87
- if commiter[:travis_preferences][:frequency] != "only_failures"
88
- send_dm(commiter[:usernames][:slack], message)
89
- end
79
+ return if ["off", "only_failures"].include?(commiter[:travis_preferences][:frequency])
80
+ send_dm(commiter[:usernames][:slack], message)
90
81
  end
91
82
 
92
83
  def act_on_assign(body, response)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-github-pinger"
3
- spec.version = "0.5.7"
3
+ spec.version = "0.5.8"
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.7
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Lapeyre