Skip to content

Add additional non-stable releases check #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions release.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import (

// Release of a repository tagged via GitHub.
type Release struct {
ID string
Name string
Description string
URL url.URL
PublishedAt time.Time
ID string
Name string
Description string
URL url.URL
PublishedAt time.Time
IsDraft bool
IsPrerelease bool
}

// IsReleaseCandidate returns true if the release name hints at an RC release.
Expand All @@ -25,7 +27,12 @@ func (r Release) IsBeta() bool {
return strings.Contains(strings.ToLower(r.Name), "beta")
}

// IsDevelopment returns true if the release name hints at a development version release.
func (r Release) IsDevelopment() bool {
return strings.Contains(strings.ToLower(r.Name), "dev")
}

// IsNonstable returns true if one of the non-stable release-checking functions return true.
func (r Release) IsNonstable() bool {
return r.IsReleaseCandidate() || r.IsBeta()
return r.IsReleaseCandidate() || r.IsBeta() || r.IsDevelopment() || r.IsDraft || r.IsPrerelease
}
24 changes: 14 additions & 10 deletions releasechecker.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ func (c *Checker) query(owner, name string) (Repository, error) {
Releases struct {
Edges []struct {
Node struct {
ID githubql.ID
Name githubql.String
Description githubql.String
URL githubql.URI
PublishedAt githubql.DateTime
ID githubql.ID
Name githubql.String
Description githubql.String
URL githubql.URI
PublishedAt githubql.DateTime
IsDraft githubql.Boolean
IsPrerelease githubql.Boolean
}
}
} `graphql:"releases(last: 1)"`
Expand Down Expand Up @@ -127,11 +129,13 @@ func (c *Checker) query(owner, name string) (Repository, error) {
URL: *query.Repository.URL.URL,

Release: Release{
ID: releaseID,
Name: string(latestRelease.Name),
Description: string(latestRelease.Description),
URL: *latestRelease.URL.URL,
PublishedAt: latestRelease.PublishedAt.Time,
ID: releaseID,
Name: string(latestRelease.Name),
Description: string(latestRelease.Description),
URL: *latestRelease.URL.URL,
PublishedAt: latestRelease.PublishedAt.Time,
IsDraft: bool(latestRelease.IsDraft),
IsPrerelease: bool(latestRelease.IsPrerelease),
},
}, nil
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy