mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 22:34:47 +00:00
* First cut of smallest rebrand, pending icons * Leave SQL schema tokens/user names the same for now * First batch of logos * Release notes/what's new * /releases missing * redirect_uri for sureapp:// * Padded logo * Test the correct /releases URL * Missed a few mobile URIs * Some icons/asssets from /website/ repo * Seed/sample data user @sure.local now * New screenshot * Want to keep their legal "boilerplate" from the upstream repo
38 lines
920 B
Ruby
38 lines
920 B
Ruby
class Provider::Github
|
|
attr_reader :name, :owner, :branch
|
|
|
|
def initialize
|
|
@name = "sure"
|
|
@owner = "we-promise"
|
|
@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
|