« GitHubWebhooks2Ikachan/Events/CommitComment.pm
↑ Summary
GitHubWebhooks2Ikachan/Events/IssueComment.pm »
| 1 | package App::GitHubWebhooks2Ikachan::Events::PullRequestReviewComment; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use utf8; | ||
| 5 | use String::IRC; | ||
| 6 | |||
| 7 | sub call { | ||
| 8 | my ($class, $context) = @_; | ||
| 9 | |||
| 10 | my $comment = $context->dat->{comment}; | ||
| 11 | |||
| 12 | (my $comment_body = $comment->{body}) =~ s/\r?\n.*//g; | ||
| 13 | my $user_name = $comment->{user}->{login}; | ||
| 14 | my $url = $comment->{html_url}; | ||
| 15 | |||
| 16 | my ($pull_request_number) = $comment->{pull_request_url} =~ m!/(\d+)\Z!; | ||
| 17 | |||
| 18 | my $main_text = "[review comment (#$pull_request_number)] $comment_body (\@$user_name)"; | ||
| 19 | return String::IRC->new($main_text)->green . " $url"; | ||
| 20 | } | ||
| 21 | |||
| 22 | 1; | ||
| 23 |