mirror of
https://github.com/ash-project/ash_hq.git
synced 2024-09-19 21:03:30 +12:00
chore: use config for api key dummy
This commit is contained in:
parent
33467d034f
commit
b935c289d2
2 changed files with 10 additions and 1 deletions
|
@ -16,6 +16,7 @@ config :open_ai,
|
|||
api_key: System.get_env("OPEN_API_API_KEY")
|
||||
|
||||
config :ash_hq, :github,
|
||||
api_key: System.get_env("GITHUB_API_KEY"),
|
||||
client_id: System.get_env("GITHUB_CLIENT_ID"),
|
||||
client_secret: System.get_env("GITHUB_CLIENT_SECRET"),
|
||||
redirect_uri: System.get_env("GITHUB_REDIRECT_URI")
|
||||
|
|
|
@ -24,9 +24,17 @@ defmodule AshHq.Github.Monitor do
|
|||
|> AshHq.Docs.read!()
|
||||
|> Stream.flat_map(fn library ->
|
||||
:timer.sleep(1000)
|
||||
opts = []
|
||||
|
||||
opts =
|
||||
if api_key = Application.get_env(:ash_hq, :github)[:api_key] do
|
||||
Keyword.put(opts, :headers, [{"Authorization", "token #{api_key}"}])
|
||||
else
|
||||
opts
|
||||
end
|
||||
|
||||
"https://api.github.com/repos/#{library.repo_org}/#{library.name}/contributors"
|
||||
|> Req.get!(headers: [{"Authorization", "token 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"}])
|
||||
|> Req.get!(opts)
|
||||
|> case do
|
||||
%{status: 200, body: body} ->
|
||||
Stream.map(body, &Map.take(&1, ["id", "avatar_url", "html_url", "login"]))
|
||||
|
|
Loading…
Reference in a new issue