From 0b273a7b168c7689d4f6c4e6033e9092dc56e77f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Wi=C5=A1o?= Date: Sun, 22 Jan 2023 11:59:39 +0100 Subject: [PATCH] fix: improve JIRA Id extraction --- changelog2jira.exs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/changelog2jira.exs b/changelog2jira.exs index 143df5e..ab075a4 100644 --- a/changelog2jira.exs +++ b/changelog2jira.exs @@ -48,7 +48,13 @@ case OptionParser.parse(System.argv(), strict: [version: :string, path: :string] {"ul", [], children, %{}}, acc -> Enum.reduce(children, acc, fn {"li", [], [{"strong", [], [jira_id], %{}} | _rest], %{}}, acc -> - [jira_id |> String.replace(":", "") |> String.upcase() | acc] + jira_id = jira_id |> String.replace(":", "") |> String.upcase() + + if String.contains?(jira_id, "-") do + String.split(jira_id, ",") ++ acc + else + acc + end _other, acc -> acc @@ -91,9 +97,7 @@ case OptionParser.parse(System.argv(), strict: [version: :string, path: :string] end _other -> - IO.puts( - "Usage: elixir changelog2jira.ex --path= --version=latest" - ) + IO.puts("Usage: elixir changelog2jira.ex --path= --version=latest") System.stop(1) end