github

package
v0.0.0-...-c1b7cd4 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLatestRelease

func GetLatestRelease(owner, repo string) (*github.RepositoryRelease, error)

GetLatestRelease retrieves the latest published release for the specified GitHub repository. It takes the repository owner and repository name as parameters and returns the latest release information or an error if the request fails.

Parameters:

  • owner: The GitHub username or organization name that owns the repository
  • repo: The name of the repository

Returns:

  • *github.RepositoryRelease: The latest release information including tag name, body, assets, etc.
  • error: An error if the API request fails or if no releases are found

Example:

release, err := GetLatestRelease("microsoft", "vscode")
if err != nil {
    log.Fatal(err)
}
fmt.Printf("Latest release: %s\n", release.GetTagName())

func GetReleaseByName

func GetReleaseByName(owner, repo, tagName string) (*github.RepositoryRelease, error)

GetReleaseByName retrieves a specific release by its tag name for the specified GitHub repository. It takes the repository owner, repository name, and the release tag name as parameters.

Parameters:

  • owner: The GitHub username or organization name that owns the repository
  • repo: The name of the repository
  • tagName: The tag name of the release (e.g., "v1.0.0")

Returns:

  • *github.RepositoryRelease: The release information including tag name, body, assets, etc.
  • error: An error if the API request fails or if the release is not found

Example:

release, err := GetReleaseByName("microsoft", "vscode", "1.85.0")
if err != nil {
    log.Fatal(err)
}
fmt.Printf("Release: %s\n", release.GetTagName())

func IsOutdatedRelease

func IsOutdatedRelease(owner, repo, version string) bool

IsOutdatedRelease checks if a given version is outdated compared to the latest release of a GitHub repository. It fetches the latest release from the specified repository and performs semantic version comparison.

Parameters:

  • owner: The owner (username or organization) of the GitHub repository
  • repo: The name of the GitHub repository
  • version: The version to check (can be with or without 'v' prefix)

Returns:

  • true if the given version is older than the latest release
  • false if the given version is up-to-date, newer, or if an error occurs (e.g., repository not found, no releases, network error)

The function automatically handles version prefixes by ensuring both versions have the 'v' prefix before performing semantic version comparison using golang.org/x/mod/semver.

Example:

outdated := IsOutdatedRelease("golang", "go", "1.20.0")
if outdated {
    fmt.Println("Your Go version is outdated")
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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