Skip to content

Commit 8d12251

Browse files
committed
Minor renaming
1 parent 3898483 commit 8d12251

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

scripts/elixir/update_packages_list.exs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ packages =
139139
]
140140
|> Enum.map(fn
141141
{type, markdown} ->
142-
%{type: type, content: markdown}
142+
%{type: type, name: markdown}
143143

144144
package when is_binary(package) ->
145145
case String.split(package, "/", parts: 2) do
@@ -155,7 +155,7 @@ gh_req_timeout = 500
155155
gh_req_mock = false
156156

157157
# gh token for larger request rate
158-
gh_auth_header =
158+
gh_auth_headers =
159159
case System.get_env("GITHUB_TOKEN") do
160160
nil -> []
161161
token -> [Authorization: "Bearer #{token}"]
@@ -167,12 +167,12 @@ repos =
167167
|> Enum.flat_map(fn org ->
168168
Stream.from_index()
169169
|> Stream.map(fn page ->
170-
if gh_auth_header == [], do: Process.sleep(gh_req_timeout)
170+
if gh_auth_headers == [], do: Process.sleep(gh_req_timeout)
171171
url = "https://api.github.com/orgs/#{org}/repos?per_page=100&page=#{page}"
172172
Logger.debug("Fetching #{url}")
173173

174174
resp =
175-
Req.get!(url, headers: gh_auth_header, decode_json: [keys: :atoms]).body
175+
Req.get!(url, headers: gh_auth_headers, decode_json: [keys: :atoms]).body
176176

177177
unless is_list(resp) do
178178
raise "Received invalid response: #{inspect(resp)}"
@@ -231,11 +231,11 @@ packages =
231231
%{owner: %{login: :mock}, html_url: :mock, description: :mock}
232232

233233
owner != nil ->
234-
if gh_auth_header == [], do: Process.sleep(gh_req_timeout)
234+
if gh_auth_headers == [], do: Process.sleep(gh_req_timeout)
235235
url = "https://api.github.com/repos/#{owner}/#{name}"
236236
Logger.debug("Fetching #{url}")
237237

238-
Req.get!(url, headers: gh_auth_header, decode_json: [keys: :atoms]).body
238+
Req.get!(url, headers: gh_auth_headers, decode_json: [keys: :atoms]).body
239239

240240
Map.has_key?(repos, name) ->
241241
Map.fetch!(repos, name)
@@ -296,11 +296,11 @@ packages_md =
296296
|> Enum.map_reduce(
297297
%{is_header_present: false},
298298
fn
299-
%{type: :section, content: content}, acc ->
300-
{"\n### " <> content, %{acc | is_header_present: false}}
299+
%{type: :section, name: name}, acc ->
300+
{"\n### " <> name, %{acc | is_header_present: false}}
301301

302-
%{type: :subsection, content: content}, acc ->
303-
{"\n#### " <> content, %{acc | is_header_present: false}}
302+
%{type: :subsection, name: name}, acc ->
303+
{"\n#### " <> name, %{acc | is_header_present: false}}
304304

305305
%{type: :package} = package, acc ->
306306
package_info = """
@@ -361,14 +361,14 @@ packages
361361

362362
%{acc | files: files}
363363

364-
%{type: type, content: content}, acc ->
364+
%{type: type, name: name}, acc ->
365365
# So that the files have correct order
366366
prefix = "#{acc.file_number}_" |> String.pad_leading(3, "0")
367367

368368
{filename, section} =
369369
case type do
370-
:section -> {content, content}
371-
:subsection -> {"#{acc.section} | #{content}", acc.section}
370+
:section -> {name, name}
371+
:subsection -> {"#{acc.section} | #{name}", acc.section}
372372
end
373373

374374
file_path =

0 commit comments

Comments
 (0)