diff --git a/lib/hex/state.ex b/lib/hex/state.ex index 114af5ee..4e004dd3 100644 --- a/lib/hex/state.ex +++ b/lib/hex/state.ex @@ -127,7 +127,7 @@ defmodule Hex.State do ci: %{ env: ["CI"], default: false, - fun: {__MODULE__, :to_boolean} + fun: {__MODULE__, :to_truthy_boolean} } } @@ -315,6 +315,15 @@ defmodule Hex.State do def to_boolean("TRUE"), do: {:ok, true} def to_boolean(_), do: :error + def to_truthy_boolean(value) do + value + |> to_boolean() + |> then(fn + :error -> {:ok, true} + boolean -> boolean + end) + end + def to_integer(nil), do: {:ok, nil} def to_integer(""), do: {:ok, nil} def to_integer(integer) when is_integer(integer), do: {:ok, integer}