Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/dispatch/dispatch.ex
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ defmodule Dispatch do
def extract_from_params(%{"pull_request" => %{"body" => body}} = params) do
default_stacks = Map.get(params, "stacks", "")

~r/#dispatch\/(\w+)/i
~r/#dispatch\/([\w.]+)/i
Copy link
Member

@Boubalou Boubalou Jan 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Une regex... un bug! La saga se poursuit! 🗡

|> Regex.scan(body, capture: :all_but_first)
|> (fn
[] -> String.split(default_stacks, ",")
Expand Down
4 changes: 2 additions & 2 deletions test/dispatch_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,11 @@ defmodule DispatchTest do

Also, there are no default stacks in the webhook URL.

#dispatch/hcl #dispatch/Ruby
#dispatch/hcl #dispatch/Ruby #dispatch/node.js
"""

stacks = Dispatch.extract_from_params(%{"pull_request" => %{"body" => body}})

assert stacks == ["hcl", "ruby"]
assert stacks == ["hcl", "ruby", "node.js"]
end
end