github

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRepoCreationYear

func GetRepoCreationYear(client *github.Client, repo GHRepo) (int, error)

GetRepoCreationYear takes in a repo and uses the GitHub API to determine the year it was created.

This is typically used to infer when the original copyright date is, but it should be noted that certain circumstances can cause the value returned may be unsuitable for use as the original copyright date. Specifically, it is possible for an older project to be recreated in a newer repo, or for the repo to be made public at a later date, at which point the year of creation and year of copyright may differ.

Types

type GHClient

type GHClient struct {
	// contains filtered or unexported fields
}

GHClient is a wrapper to access Github Client's API endpoints easily

func NewGHClient

func NewGHClient() *GHClient

NewGHClient uses the copyright Github App for client requests

func (*GHClient) Raw

func (c *GHClient) Raw() *github.Client

Raw is a util function to access the Github Client directly

type GHClientConfig

type GHClientConfig struct {
	// contains filtered or unexported fields
}

GHClientConfig is the configuration portion of the GH client (mostly for GH App)

type GHRepo

type GHRepo struct {
	Owner string
	Name  string
}

GHRepo is a repo

func DiscoverRepo

func DiscoverRepo() (GHRepo, error)

DiscoverRepo attempts to find if the current directory is related to a GitHub repo and, if so, what the organization name and repo name are

This function will return an error if more than one GitHub repos are associated with the given folder. This can happen if multiple git upstreams defined.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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