ghrepo

package
v0.5.1-42-g5777bdc Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2023 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BranchArchive

func BranchArchive(repo Interface, branch string) string

BranchArchive returns the archive URL of a branch given an interface and a branch

func DownloadAsset

func DownloadAsset(httpClient *http.Client, asset ReleaseAsset, destPath string) error

DownloadAsset downloads a single asset to the given file path.

func FormatRemoteURL

func FormatRemoteURL(repo Interface, protocol string) string

TODO there is a parallel implementation for non-isolated commands

func FullName

func FullName(r Interface) string

FullName serializes a GitHub repository into an "OWNER/REPO" string

func GenerateRepoURL

func GenerateRepoURL(repo Interface, p string, args ...interface{}) string

func HasScript

func HasScript(httpClient *http.Client, repo Interface) (hs bool, err error)

func IsSame

func IsSame(a, b Interface) bool

IsSame compares two GitHub repositories

func SHAArchive

func SHAArchive(repo Interface, sha string) string

SHAArchive returns the archive URL of a given Git SHA given an Interface and a SHA

func SetDefaultHost

func SetDefaultHost(host string)

SetDefaultHost overrides the default GitHub hostname for FromFullName. TODO: remove after FromFullName approach is revisited

func TagArchive

func TagArchive(repo Interface, tag string) string

TagArchive returns the archive URL of a tag given an Interface and a tag

Types

type Interface

type Interface interface {
	RepoName() string
	RepoOwner() string
	RepoHost() string
}

Interface describes an object that represents a GitHub repository

func FromFullName

func FromFullName(nwo string) (Interface, error)

FromFullName extracts the GitHub repository information from the following formats: "OWNER/REPO", "HOST/OWNER/REPO", and a full URL.

func FromFullNameWithHost

func FromFullNameWithHost(nwo, fallbackHost string) (Interface, error)

FromFullNameWithHost is like FromFullName that defaults to a specific host for values that don't explicitly include a hostname.

func FromURL

func FromURL(u *url.URL) (Interface, error)

FromURL extracts the GitHub repository information from a git remote URL

func New

func New(owner, repo string) Interface

New instantiates a GitHub repository from owner and name arguments

func NewFromURL

func NewFromURL(path string) (Interface, error)

NewFromURL parses a given GitHub url and returns the populated Interface

func NewWithHost

func NewWithHost(owner, repo, hostname string) Interface

NewWithHost is like New with an explicit host name

type Release

type Release struct {
	Tag    string `json:"tag_name"`
	Assets []ReleaseAsset
}

func FetchLatestRelease

func FetchLatestRelease(httpClient *http.Client, baseRepo Interface) (*Release, error)

FetchLatestRelease finds the latest published release for a repository.

type ReleaseAsset

type ReleaseAsset struct {
	Name   string
	APIURL string `json:"url"`
}

Jump to

Keyboard shortcuts

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