gh

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 7 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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchReleases

func FetchReleases(repoURL string, onlyLatest bool) ([]*github.RepositoryRelease, error)

FetchReleases fetches GitHub releases for a given repository URL. If `onlyLatest` is true, it returns the most recent release. Otherwise, it returns all releases.

Parameters:

  • repoURL: The URL of the GitHub repository (e.g., "https://github.com/owner/repo").
  • onlyLatest: A boolean flag indicating whether to fetch only the latest release.

Returns:

  • []*github.RepositoryRelease: A slice of GitHub repository releases.
  • error: An error if the releases could not be fetched.

Example:

releases, err := FetchReleases("https://github.com/owner/repo", true)
if err != nil {
    log.Fatalf("Error fetching releases: %v", err)
}
for _, release := range releases {
    fmt.Printf("Release: %s\n", *release.TagName)
}

func GetOwnerAndRepoFromURL

func GetOwnerAndRepoFromURL(repoURL string) (owner, repo string, err error)

GetOwnerAndRepoFromURL extracts the owner and repository name from a GitHub URL.

Parameters:

Returns:

  • owner: The owner of the repository.
  • repo: The name of the repository.
  • err: An error if the URL could not be parsed or is in an invalid format.

Example:

owner, repo, err := GetOwnerAndRepoFromURL("https://github.com/owner/repo")
if err != nil {
    log.Fatalf("Error parsing URL: %v", err)
}
fmt.Printf("Owner: %s, Repo: %s\n", owner, repo)

Types

This section is empty.

Jump to

Keyboard shortcuts

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