1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-25 08:09:38 +02:00

Changelog page that pulls from Github Release notes (#867)

* Changelog page that pulls from Github Release notes

* Review changelog page styles

* Move changelog page title to i18n translations
This commit is contained in:
Mattia 2024-06-14 22:40:50 +02:00 committed by GitHub
parent 957584b69c
commit 5da34c4609
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 100 additions and 26 deletions

View file

@ -40,6 +40,26 @@ class Provider::Github
end
end
def fetch_latest_releases_notes
begin
Rails.cache.fetch("latest_github_releases_notes", expires_in: 2.hours) do
releases = Octokit.releases(repo)
releases.map do |release|
{
avatar: release.author.avatar_url,
name: release.name,
published_at: release.published_at,
body: Octokit.markdown(release.body, mode: "gfm", context: repo)
}
end
end
rescue => e
Rails.logger.error "Failed to fetch latest GitHub releases notes: #{e.message}"
[]
end
end
private
def repo
"#{owner}/#{name}"