Documentation
¶
Overview ¶
Package github provides a client for checking GitHub releases and a file-based cache for update notifications.
Index ¶
Constants ¶
const ( // RepoOwner is the GitHub organization that owns the panda repository. RepoOwner = "ethpandaops" // RepoName is the GitHub repository name. RepoName = "panda" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Asset ¶
type Asset struct {
Name string `json:"name"`
BrowserDownloadURL string `json:"browser_download_url"`
}
Asset represents a downloadable file attached to a release.
type Release ¶
type Release struct {
TagName string `json:"tag_name"`
HTMLURL string `json:"html_url"`
Assets []Asset `json:"assets"`
}
Release represents a GitHub release.
func (*Release) ChecksumsAsset ¶
ChecksumsAsset returns the checksums.txt asset from the release.
func (*Release) FindAsset ¶
FindAsset returns the binary asset for the given OS, architecture, and binary name. Asset names follow the goreleaser pattern: {binaryName}_{version}_{os}_{arch}.tar.gz
func (*Release) FindCurrentPlatformAsset ¶
FindCurrentPlatformAsset returns the asset for the CLI binary matching the current runtime.
type ReleaseChecker ¶
type ReleaseChecker struct {
// contains filtered or unexported fields
}
ReleaseChecker fetches release information from the GitHub API.
func NewReleaseChecker ¶
func NewReleaseChecker(owner, repo string) *ReleaseChecker
NewReleaseChecker creates a checker for the given GitHub owner/repo.
func (*ReleaseChecker) LatestRelease ¶
func (r *ReleaseChecker) LatestRelease(ctx context.Context) (*Release, error)
LatestRelease fetches the most recent non-prerelease release.
type UpdateCache ¶
type UpdateCache struct {
LatestVersion string `json:"latest_version"`
CheckedAt time.Time `json:"checked_at"`
}
UpdateCache stores the result of a GitHub release check.
func LoadCache ¶
func LoadCache() (*UpdateCache, error)
LoadCache reads the cache from disk. Returns nil, nil if the file does not exist.
func (*UpdateCache) IsFresh ¶
func (c *UpdateCache) IsFresh() bool
IsFresh returns true if the cache is younger than the TTL.