@@ -148,6 +148,25 @@ func getTelegramPullRequestPayload(p *api.PullRequestPayload) (*TelegramPayload,
148
148
}, nil
149
149
}
150
150
151
+ func getTelegramPullRequestApprovalPayload (p * api.PullRequestPayload , event models.HookEventType ) (* TelegramPayload , error ) {
152
+ var text , attachmentText string
153
+ switch p .Action {
154
+ case api .HookIssueSynchronized :
155
+ action , err := parseHookPullRequestEventType (event )
156
+ if err != nil {
157
+ return nil , err
158
+ }
159
+
160
+ text = fmt .Sprintf ("[%s] Pull request review %s: #%d %s" , p .Repository .FullName , action , p .Index , p .PullRequest .Title )
161
+ attachmentText = p .Review .Content
162
+
163
+ }
164
+
165
+ return & TelegramPayload {
166
+ Message : text + "\n " + attachmentText ,
167
+ }, nil
168
+ }
169
+
151
170
func getTelegramRepositoryPayload (p * api.RepositoryPayload ) (* TelegramPayload , error ) {
152
171
var title string
153
172
switch p .Action {
@@ -192,6 +211,8 @@ func GetTelegramPayload(p api.Payloader, event models.HookEventType, meta string
192
211
return getTelegramPushPayload (p .(* api.PushPayload ))
193
212
case models .HookEventPullRequest :
194
213
return getTelegramPullRequestPayload (p .(* api.PullRequestPayload ))
214
+ case models .HookEventPullRequestRejected , models .HookEventPullRequestApproved , models .HookEventPullRequestComment :
215
+ return getTelegramPullRequestApprovalPayload (p .(* api.PullRequestPayload ), event )
195
216
case models .HookEventRepository :
196
217
return getTelegramRepositoryPayload (p .(* api.RepositoryPayload ))
197
218
case models .HookEventRelease :
0 commit comments