lita-github-pinger 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/handlers/github_pinger.rb +40 -2
- data/lita-github-pinger.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f44cec44e12fb74dd6be99f474bb5f764f2b5f90
|
4
|
+
data.tar.gz: 322afdae8aad9ccb59680e3e84a21087e6163bca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
data/lita-github-pinger.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "lita-github-pinger"
|
3
|
-
spec.version = "0.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."
|