Documentation
¶
Overview ¶
Package github provides a wrapper around GitHub's APIs in a manner compliant with the forge.Forge interface.
Index ¶
- Constants
- type CLITokenSource
- type Forge
- type Repository
- func (r *Repository) EditChange(ctx context.Context, id forge.ChangeID, opts forge.EditChangeOptions) error
- func (r *Repository) FindChangeByID(ctx context.Context, id forge.ChangeID) (*forge.FindChangeItem, error)
- func (r *Repository) FindChangesByBranch(ctx context.Context, branch string) ([]*forge.FindChangeItem, error)
- func (r *Repository) IsMerged(ctx context.Context, id forge.ChangeID) (bool, error)
- func (r *Repository) ListChangeTemplates(ctx context.Context) ([]*forge.ChangeTemplate, error)
- func (r *Repository) SubmitChange(ctx context.Context, req forge.SubmitChangeRequest) (forge.SubmitChangeResult, error)
Constants ¶
const ( // DefaultURL is the default URL for GitHub. DefaultURL = "https://github.com" // DefaultAPIURL is the default URL for the GitHub API. DefaultAPIURL = "https://api.github.com" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CLITokenSource ¶
type CLITokenSource struct{}
CLITokenSource is an oauth2 token source that uses the GitHub CLI to get a token.
This is not super safe and we should probably nuke it.
type Forge ¶
type Forge struct { // URL is the URL for GitHub. // Override this for testing or GitHub Enterprise. URL string // APIURL is the URL for the GitHub API. // Override this for testing or GitHub Enterprise. APIURL string // Token is the OAuth2 token source to use // to authenticate with GitHub. Token oauth2.TokenSource // Log specifies the logger to use. Log *log.Logger }
Forge builds a GitHub Forge.
func (*Forge) OpenURL ¶
OpenURL opens a GitHub repository from a remote URL. Returns forge.ErrUnsupportedURL if the URL is not a valid GitHub URL.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository is a GitHub repository.
func (*Repository) EditChange ¶
func (r *Repository) EditChange(ctx context.Context, id forge.ChangeID, opts forge.EditChangeOptions) error
EditChange edits an existing change in a repository.
func (*Repository) FindChangeByID ¶
func (r *Repository) FindChangeByID(ctx context.Context, id forge.ChangeID) (*forge.FindChangeItem, error)
FindChangeByID searches for a change with the given ID.
func (*Repository) FindChangesByBranch ¶
func (r *Repository) FindChangesByBranch(ctx context.Context, branch string) ([]*forge.FindChangeItem, error)
FindChangesByBranch searches for open changes with the given branch name. Returns [ErrNotFound] if no changes are found.
func (*Repository) ListChangeTemplates ¶
func (r *Repository) ListChangeTemplates(ctx context.Context) ([]*forge.ChangeTemplate, error)
ListChangeTemplates returns PR templates defined in the repository.
func (*Repository) SubmitChange ¶
func (r *Repository) SubmitChange(ctx context.Context, req forge.SubmitChangeRequest) (forge.SubmitChangeResult, error)
SubmitChange creates a new change in a repository.