Skip to content

Commit

Permalink
updates #62 to check if there are any reviewers before adding a no as…
Browse files Browse the repository at this point in the history
…signee warning #128
  • Loading branch information
naazy committed Aug 18, 2017
1 parent 4d1b10f commit 46ae7f5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions web/controllers/rules/pr/no_assignee.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ defmodule Dwylbot.Rules.PR.NoAssignee do
@rule_name "pr_no_assignee"

def apply?(payload) do
payload["action"] in ~w(labeled unassigned assigned)
reviewers = payload["pull_request"]["requested_reviewers"] |> Enum.map(&(&1["login"]))
payload["action"] in ~w(labeled unassigned assigned) && Enum.empty?(reviewers)
end

def check(payload, _get_data?, token) do
Expand Down Expand Up @@ -37,7 +38,7 @@ defmodule Dwylbot.Rules.PR.NoAssignee do

defp error_message(login) do
"""
:warning: @#{login}, the pull request is in "awaiting-review" but doesn't have a correct assignee.
:warning: @#{login}, the pull request is in "awaiting-review" but doesn't have a reviewer or a correct assignee.
Please assign someone to review the pull request, thanks.
"""
end
Expand Down

0 comments on commit 46ae7f5

Please sign in to comment.