Documentation ¶
Overview ¶
Package github contains libraries for using github repositories that make serverless operations easy to follow.
Index ¶
- type RepoID
- type Repository
- func (r *Repository) CommitFile(ctx context.Context, path string, raw []byte, branch, commitMsg string) error
- func (r *Repository) CreateOrUpdateBranch(ctx context.Context, branchName string) error
- func (r *Repository) CreatePR(ctx context.Context, title, commitBranch string) error
- func (r *Repository) ReadFile(ctx context.Context, path string) ([]byte, error)
- func (r Repository) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RepoID ¶
RepoID identifies a github project, including owner & repo.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository represents a github repository with a working area and an upstream. The upstream repo must allow PRs. The working fork is usually owned by the user; commits are pushed to branches here and proposed against the upstream repository.
func NewRepository ¶
func NewRepository(ctx context.Context, c *http.Client, upstream RepoID, upstreamBranch string, fork RepoID, ghUser, ghEmail, ghToken string) (Repository, error)
NewRepository creates a wrapper around a git repository which has a fork owned by the user, and an upstream repository configured that PRs can be proposed against.
func (*Repository) CommitFile ¶
func (r *Repository) CommitFile(ctx context.Context, path string, raw []byte, branch, commitMsg string) error
CommitFile creates a commit on a repo's worktree which overwrites the specified file path with the provided bytes.
func (*Repository) CreateOrUpdateBranch ¶
func (r *Repository) CreateOrUpdateBranch(ctx context.Context, branchName string) error
CreateOrUpdateBranch attempts to create a new branch on the fork repo if it doesn't already exist, or rebase it onto HEAD if it does.
func (*Repository) CreatePR ¶
func (r *Repository) CreatePR(ctx context.Context, title, commitBranch string) error
CreatePR creates a pull request. Based on: https://godoc.org/github.com/google/go-github/github#example-PullRequestsService-Create
func (*Repository) ReadFile ¶
ReadFile returns the contents of the specified path from the configured upstream repo.
func (Repository) String ¶
func (r Repository) String() string