Bonfire.Common.Changelog.Github.DataGrabber (Bonfire v1.0.1-social-alpha.9)

View Source

Datagrabber for changelog generation, Versioce.Config.Changelog.datagrabber/0

Uses repository history to obtain and format data.

Summary

Functions

Filters a list of items (issues, PRs, or commits) to only include those with a relevant date field (closedAt, mergedAt, etc) within the given date window. Items without a date field are always included. Raises if any out-of-range items are found (for debugging).

Normalize a date string or Date struct to "YYYY-MM-DD".

Functions

fetch_issues(opts \\ [])

filter_items_by_date(items, after_date, before_date)

filter_items_by_date!(items, after_date, before_date)

Filters a list of items (issues, PRs, or commits) to only include those with a relevant date field (closedAt, mergedAt, etc) within the given date window. Items without a date field are always included. Raises if any out-of-range items are found (for debugging).

The date field checked is, in order:

  • "closedAt", "closed_at"
  • "mergedAt", "merged_at"
  • "matched_issue_closed_at"
  • "matched_issue.mergedAt", "matched_issue.merged_at"
  • "matched_issue.closedAt", "matched_issue.closed_at"

Examples

iex> items = [
...>   %{"number" => 1, "closedAt" => "2025-10-10T12:00:00Z"},
...>   %{"number" => 2, "mergedAt" => "2025-10-15T12:00:00Z"},
...>   %{"number" => 3, "closedAt" => "2024-01-01T12:00:00Z"}
...> ]
iex> Bonfire.Common.Changelog.Github.DataGrabber.filter_items_by_date!(items, "2025-10-01", "2025-10-31")
[%{"number" => 1, "closedAt" => "2025-10-10T12:00:00Z"}, %{"number" => 2, "mergedAt" => "2025-10-15T12:00:00Z"}]

format_issue(item)

get_first_changelog_date()

normalize_date(date)

Normalize a date string or Date struct to "YYYY-MM-DD".

iex> Bonfire.Common.Changelog.Github.DataGrabber.normalize_date("2025-10-2")
"2025-10-02"

iex> Bonfire.Common.Changelog.Github.DataGrabber.normalize_date("2025-1-9")
"2025-01-09"

iex> Bonfire.Common.Changelog.Github.DataGrabber.normalize_date("2025-10-02")
"2025-10-02"

iex> Bonfire.Common.Changelog.Github.DataGrabber.normalize_date(~D[2025-10-2])
"2025-10-02"

iex> Bonfire.Common.Changelog.Github.DataGrabber.normalize_date(nil)
nil