   alias Gullintanni.Comment
   alias Gullintanni.Repo
   alias Gullintanni.Worker
-  require Logger
 
   @typedoc "The pipeline type"
   @type t ::
     %Pipeline{
       config: Config.t,
       repo: Repo.t,
+      bot_name: String.t,
       merge_requests: map,
       worker: Worker.t
     }

  defstruct [
    config: [],
    repo: nil,
    merge_requests: %{},
    worker: nil
  ]

    end
  end

  @spec from_config(Config.t) :: t
  defp from_config(config) do
    repo = Repo.new(config[:repo_provider], config[:repo_owner], config[:repo_name])
    bot_name = repo.provider.whoami(config)
    reqs =
      repo.provider.download_merge_requests(repo, config)
      |> Map.new(fn req -> {req.id, req} end)

    %Pipeline{
      config: config,
      repo: repo,
      bot_name: bot_name,
      merge_requests: reqs,
      worker: config[:worker]
    }
  end

  @spec handle_comment(Comment.t, Repo.t) :: :ok
