1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 05:09:38 +02:00
Maybe/app/models/provider/github.rb
Zach Gollwitzer 19cc63c8f4
Use Redis for ActiveJob and ActionCable (#2004)
* Use Redis for ActiveJob and ActionCable

* Fix alwaysApply setting

* Update queue names and weights

* Tweak weights

* Update job queues

* Update docker setup guide

* Remove deprecated upgrade columns from users table

* Refactor Redis configuration for Sidekiq and caching in production environment

* Add Sidekiq Sentry monitoring

* queue naming fix

* Clean up schema
2025-03-19 12:36:16 -04:00

37 lines
924 B
Ruby

class Provider::Github
attr_reader :name, :owner, :branch
def initialize
@name = "maybe"
@owner = "maybe-finance"
@branch = "main"
end
def fetch_latest_release_notes
begin
Rails.cache.fetch("latest_github_release_notes", expires_in: 2.hours) do
release = Octokit.releases(repo).first
if release
{
avatar: release.author.avatar_url,
# this is the username, it would be nice to get the full name
username: release.author.login,
name: release.name,
published_at: release.published_at,
body: Octokit.markdown(release.body, mode: "gfm", context: repo)
}
else
nil
end
end
rescue => e
Rails.logger.error "Failed to fetch latest GitHub release notes: #{e.message}"
nil
end
end
private
def repo
"#{owner}/#{name}"
end
end