lita-github-pinger 0.1.5 → 0.1.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 +4 -4
- data/lib/lita/handlers/github_pinger.rb +20 -9
- data/lita-github-pinger.gemspec +1 -1
- data/spec/lita/handlers/github_pinger_spec.rb +9 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ec059d6207155788e7c6b5e118aab41d182e17a
|
4
|
+
data.tar.gz: 5e30bc5beba43aa299bda1b4f63e88b0491bf73a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8649f1a775c5771c91b8282a18eb764a97617fbfc4eb9005325755316420d1b9778a70b8c96dbc5a4161fe4a0ebf732d994596366b5736be98af4205607ef95
|
7
|
+
data.tar.gz: e0ce2f411d54b209f06fff49e5acffb83a1908bd4d5ce09c699a62e4c17029dcd86bcbf9acf2f0a2ab0654e205b40919113fa9411a54bebd104bc9082c74f7a1
|
@@ -2,21 +2,32 @@ 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
|
+
|
5
7
|
config :engineers, type: Array, required: true
|
6
8
|
|
7
|
-
route(
|
9
|
+
route(GITHUB_PR_COMMENT_REGEX, :detect_comment, command: false)
|
8
10
|
|
9
11
|
def detect_comment(message)
|
10
|
-
|
11
|
-
|
12
|
+
pr_id,
|
13
|
+
pr_title,
|
14
|
+
assigned_person,
|
15
|
+
comment_author,
|
16
|
+
comment_text = message.matches[0]
|
12
17
|
|
13
|
-
#
|
14
|
-
|
15
|
-
|
16
|
-
|
18
|
+
# return unless message.user.metadata["name"] == "" # Integrations don't have names
|
19
|
+
return unless comment_text.include?("@")
|
20
|
+
|
21
|
+
mentioned_username = comment_text.split("@")[1].split(" ").first
|
17
22
|
|
18
|
-
|
19
|
-
|
23
|
+
config.engineers.each do |engineer|
|
24
|
+
if engineer[:github] == mentioned_username
|
25
|
+
content = %Q{#{engineer[:slack]}, you were mentioned by #{comment_author}:
|
26
|
+
http://github.com/everlane/everlane.com/pulls/#{pr_id}
|
27
|
+
> #{comment_text}
|
28
|
+
}
|
29
|
+
message.reply(content)
|
30
|
+
end
|
20
31
|
end
|
21
32
|
end
|
22
33
|
end
|
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.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."
|
@@ -43,7 +43,14 @@ describe Lita::Handlers::GithubPinger, lita_handler: true do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it "will respond" do
|
46
|
-
send_message(
|
47
|
-
|
46
|
+
send_message(%q{
|
47
|
+
[Everlane/everlane.com] New comment on pull request #1137: More accurate location data and (by extension) working weather for factories (assigned to taylorlapeyre)
|
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/pulls/1137
|
53
|
+
> @taylorlapeyre hai
|
54
|
+
}
|
48
55
|
end
|
49
56
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-github-pinger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taylor Lapeyre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|