lita-github-pinger 0.1.8 → 0.1.9
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 +11 -26
- data/lita-github-pinger.gemspec +1 -1
- data/spec/lita/handlers/github_pinger_spec.rb +2 -9
- 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: 3a3d82bf0baafe7a5419a8f82de49e1cedc3e5ff
|
4
|
+
data.tar.gz: 0f0b885ce1c21b95462c6336d89c3b9dfb0dc1cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6638e2a20b0350ebe248f20162c423eda4733f1e8eb956429bf4c754633b458bfba191ef75dbf296315af42e8756461e38d1cdfcf252ff23861ccbcfb242c9a6
|
7
|
+
data.tar.gz: b5a60325b56f1bb91c76cc7e050a67a4c6c3e945a62583ddaa4caf911b0e21a08fa3e46b24d0c14fa83cecda8bd3814ca1c1c1bfcde2e0394fe8bd2a3e6809d3
|
@@ -2,40 +2,25 @@ module Lita
|
|
2
2
|
module Handlers
|
3
3
|
class GithubPinger < Handler
|
4
4
|
|
5
|
-
GITHUB_PR_COMMENT_REGEX = /\[Everlane\/.*\] New comment on pull request #(\d+): (.+) \(assigned to (\w+)\)\nComment by (\w+)\n(.*)/
|
6
|
-
|
7
5
|
config :engineers, type: Array, required: true
|
8
6
|
|
9
|
-
route(
|
10
|
-
route(/testing/, :see_what_happens, command: false)
|
11
|
-
|
12
|
-
def see_what_happens(message)
|
13
|
-
message.reply message.message.body
|
14
|
-
end
|
7
|
+
route(/@(\w*)/, :detect_comment, command: false)
|
15
8
|
|
16
9
|
def detect_comment(message)
|
17
|
-
|
18
|
-
|
19
|
-
assigned_person,
|
20
|
-
comment_author,
|
21
|
-
comment_text = message.matches[0]
|
22
|
-
|
23
|
-
# return unless message.user.metadata["name"] == "" # Integrations don't have names
|
24
|
-
return unless comment_text.include?("@")
|
10
|
+
return unless message.user.metadata["name"] == "" # Integrations don't have names
|
11
|
+
mentioned_username = message.matches[0][0]
|
25
12
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
if engineer[:github] == mentioned_username
|
30
|
-
content = %Q{#{engineer[:slack]}, you were mentioned by #{comment_author}:
|
31
|
-
http://github.com/everlane/everlane.com/pull/#{pr_id}
|
32
|
-
> #{comment_text}
|
33
|
-
}
|
34
|
-
message.reply(content)
|
13
|
+
# side effects intentional
|
14
|
+
found = config.engineers.any? do |eng|
|
15
|
+
if eng[:github] == mentioned_username
|
35
16
|
user = Lita::User.find_by_name(engineer[:slack])
|
36
|
-
robot.send_message(user,
|
17
|
+
robot.send_message(user, "New PR comment! #{message.message.body}")
|
37
18
|
end
|
38
19
|
end
|
20
|
+
|
21
|
+
unless found
|
22
|
+
message.reply("Could not find a slack username for #{pr_owner}. Please configure everbot to include this username.")
|
23
|
+
end
|
39
24
|
end
|
40
25
|
end
|
41
26
|
|
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.1.
|
3
|
+
spec.version = "0.1.9"
|
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."
|
@@ -43,14 +43,7 @@ describe Lita::Handlers::GithubPinger, lita_handler: true do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it "will respond" do
|
46
|
-
send_message(
|
47
|
-
|
48
|
-
Comment by thenanyu
|
49
|
-
@taylorlapeyre hai
|
50
|
-
})
|
51
|
-
expect(replies.last).to eq %q{taylor, you were mentioned by thenanyu:
|
52
|
-
http://github.com/everlane/everlane.com/pull/1137
|
53
|
-
> @taylorlapeyre hai
|
54
|
-
}
|
46
|
+
send_message("comments up @taylorlapeyre)")
|
47
|
+
expect(replies.count).to eq 0
|
55
48
|
end
|
56
49
|
end
|