gh-events 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/gh/events/text.rb +16 -1
- data/lib/gh/events/version.rb +1 -1
- data/res/slack.yml +7 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23309b6819c759bd4ae39468e40dc374409484ae1ec4568c42713ba82dbf305e
|
4
|
+
data.tar.gz: f9decf307c3770b981bbca41bb149f008a59aa8279a2b01ef59e4adb8d55a44b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e24a1288484269407ae8761f2db4b49e6f6f0413e7ab4bdbd43e2405f87c8ce71ac117feb42cb82bfe756a2acbf9122180b1169901380acc82db3698001adefa
|
7
|
+
data.tar.gz: 37c811378a88220d83d070ac5bb02ae8466e6e1be977a40307a32610b11f071a56d319832b50671c931d2d738a336fa5b9d9b21236cc32a7ef861da5295bd570
|
data/Gemfile.lock
CHANGED
data/lib/gh/events/text.rb
CHANGED
@@ -47,7 +47,22 @@ module GH::Events::Text
|
|
47
47
|
# if there is no template use a default
|
48
48
|
template ||= templates['no_template']
|
49
49
|
|
50
|
-
render(template, event).gsub(/[\n\r]+/, '\n')
|
50
|
+
res = render(template, event).gsub(/[\n\r]+/, '\n')
|
51
|
+
validate(res, dict)
|
52
|
+
res
|
53
|
+
end
|
54
|
+
|
55
|
+
# Validate the format of the response in case it's JSON
|
56
|
+
def validate(response, channel)
|
57
|
+
return unless channel == "slack"
|
58
|
+
begin
|
59
|
+
JSON.parse(response)
|
60
|
+
rescue Exception => e
|
61
|
+
warn "Rendered template is not valid JSON"
|
62
|
+
warn e
|
63
|
+
exit 1
|
64
|
+
end
|
65
|
+
response
|
51
66
|
end
|
52
67
|
|
53
68
|
def templates_file(dict)
|
data/lib/gh/events/version.rb
CHANGED
data/res/slack.yml
CHANGED
@@ -17,7 +17,7 @@ commit_comment:
|
|
17
17
|
commit <<%= comment.html_url %>|`<%= comment.commit_id %>`>
|
18
18
|
on <<%= repository.html_url %>|<%= repository.full_name %>>
|
19
19
|
attachments:
|
20
|
-
- fallback: <%= comment.body %>
|
20
|
+
- fallback: <%= comment.body.gsub(/"/,'\"') %>
|
21
21
|
color: '#36a64f'
|
22
22
|
# pretext: Optional text that appears above the attachment block
|
23
23
|
author_name: <%= sender.login %>
|
@@ -25,7 +25,7 @@ commit_comment:
|
|
25
25
|
author_icon: <%= sender.avatar_url %>
|
26
26
|
# title: Slack API Documentation
|
27
27
|
# title_link: https://api.slack.com/
|
28
|
-
text: <%= comment.body %>
|
28
|
+
text: <%= comment.body.gsub(/"/,'\"') %>
|
29
29
|
# fields:
|
30
30
|
# - title: Priority
|
31
31
|
# value: High
|
@@ -57,14 +57,14 @@ issue_comment:
|
|
57
57
|
:left_speech_bubble:
|
58
58
|
<<%= sender.html_url %>|<%= sender.login %>>
|
59
59
|
commented
|
60
|
-
on <<%= comment.html_url %>|<%= issue.title %>>
|
60
|
+
on <<%= comment.html_url %>|<%= issue.title.gsub(/"/,'\"') %>>
|
61
61
|
attachments:
|
62
|
-
- fallback: <%= comment.body %>
|
62
|
+
- fallback: <%= comment.body.gsub(/"/,'\"') %>
|
63
63
|
color: '#36a64f'
|
64
64
|
author_name: <%= sender.login %>
|
65
65
|
author_link: <%= sender.html_url %>
|
66
66
|
author_icon: <%= sender.avatar_url %>
|
67
|
-
text: <%= comment.body %>
|
67
|
+
text: <%= comment.body.gsub(/"/,'\"') %>
|
68
68
|
|
69
69
|
issues:
|
70
70
|
text: >-
|
@@ -143,12 +143,12 @@ pull_request_review_comment:
|
|
143
143
|
new review comment
|
144
144
|
on <<%= comment.html_url %>|<%= pull_request.title %>>
|
145
145
|
attachments:
|
146
|
-
- fallback: <%= comment.body %>
|
146
|
+
- fallback: <%= comment.body.gsub(/"/,'\"') %>
|
147
147
|
color: red
|
148
148
|
author_name: <%= sender.login %>
|
149
149
|
author_link: <%= sender.html_url %>
|
150
150
|
author_icon: <%= sender.avatar_url %>
|
151
|
-
text: <%= comment.body %>
|
151
|
+
text: <%= comment.body.gsub(/"/,'\"') %>
|
152
152
|
|
153
153
|
star:
|
154
154
|
text: >-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gh-events
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phil Hofmann
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|