releasediff

package module
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2025 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

github-releasediff

Simple go package to get number of releases between two releases.

The github client used is google/go-github

Usage

// Create a github client
tc := oauth2.NewClient(context.Background(), oauth2.StaticTokenSource(
  &oauth2.Token{AccessToken: os.Getenv("GITHUB_TOKEN"), TokenType: "token"},
))
client := github.NewClient(tc)

//
ghr, err := releasediff.New(client, "goharbor", "harbor", "v2.0.2", "", nil)
if err != nil {
  panic(err)
}

diff, releaseNotes, err := ghr.Diff()
if err != nil {
  panic(err)
}
fmt.Printf("There are %d releases between %s and %s\n", diff, ghr.Release, ghr.Options.Release)
fmt.Printf("This is the release notes: \n%v", releaseNotes)
fmt.Printf("%v\n", resp.Rate)

// Output:
// There are 2 releases between v2.0.2 and v2.1.0
// github.Rate{Limit:5000, Remaining:4685, Reset:github.Timestamp{2020-10-07 09:30:12 +0200 CEST}}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitHubReleases

type GitHubReleases struct {
	Owner        string             // REQUIRED. Owner of the repo.
	Repo         string             // REQUIRED. Name of the repo.
	Release      string             // REQUIRED. Tag name of the release you want to check.
	Client       *github.Client     // Github client used to make the calls to the github api.
	Versions     []*version.Version // Ordered list of all versions.
	ReleaseNotes map[string]string  // A map of releases with release notes.
	Options      *Options           // Optional options
}

GitHubReleases holds the two releases to compare

func New

func New(client *github.Client, owner string, repo string, release string, options *Options) (*GitHubReleases, *github.Response, error)

New creates a new GitHubReleases

func (*GitHubReleases) Diff

func (ghr *GitHubReleases) Diff() int

func (*GitHubReleases) DiffWithReleaseNotes added in v0.3.0

func (ghr *GitHubReleases) DiffWithReleaseNotes() (int, []ReleaseNote)

Diff will fetch all releases until a specific release

type Options added in v0.1.3

type Options struct {
	Release            string // Tag name of the release you want to compare with. If empty, newest version will be used.
	Filter             string // Regex to to filter releases on. Keep empty if you want all releases.
	IncludePreReleases bool   // Whether to include pre-releases or not. Default is false.
	IncludeDrafts      bool   // Whether to include drafts or not. Default is false.
	VerifyRelease      bool   // Whether to verify that the provided versions exists as a release.
}

Options is optional stuff that can be sent when calling "New"

type ReleaseNote added in v0.3.0

type ReleaseNote struct {
	Version string
	Body    string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL