Bonfire.Common.Changelog.Github.DataGrabber (Bonfire v1.0.1-social-alpha.9)
View SourceDatagrabber 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
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"}]
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