-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from danielma/dma/emojis-with-pr-title
feat: show PR title in message
- Loading branch information
Showing
4 changed files
with
37 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
module ReviewBot | ||
class Notification | ||
def initialize(pull_request:, suggested_reviewers:) | ||
@pull_request = pull_request | ||
@suggested_reviewers = suggested_reviewers | ||
end | ||
|
||
attr_reader :pull_request, :suggested_reviewers | ||
|
||
def message | ||
[needs_review_from, pull_request.html_url].join("\n") | ||
end | ||
|
||
private | ||
|
||
def needs_review_from | ||
[ | ||
%("#{pull_request.title}" needs a #{needed_review_type} from), | ||
suggested_reviewers.map(&:slack_emoji).join(' ') | ||
].join(' ') | ||
end | ||
|
||
def needed_review_type | ||
pull_request.needs_first_review? ? 'first review' : 'second review' | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters