{"modulePath":"github.com/google/trillian-examples","version":"v0.0.0-20261116100501-6931e6365663","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package github\n\nPackage github contains libraries for using github repositories that make serverless operations easy to follow.\n\n## Types\n\n```go\ntype RepoID struct {\n\tOwner    string\n\tRepoName string\n}\n```\nRepoID identifies a github project, including owner \u0026 repo.\n\n```go\nfunc NewRepoID(or string) (RepoID, error)\n```\nNewRepoID creates a new RepoID struct from an owner/repo fragment.\n\n```go\nfunc (r RepoID) String() string\n```\nString returns \"\\\u003cowner\u003e/\\\u003crepo\u003e\".\n\n```go\ntype Repository struct {\n\t// contains filtered or unexported fields\n}\n```\nRepository 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.\n\n```go\nfunc NewRepository(ctx context.Context, c *http.Client, upstream RepoID, upstreamBranch string, fork RepoID, ghUser, ghEmail, ghToken string) (Repository, error)\n```\nNewRepository 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.\n\n```go\nfunc (r *Repository) CommitFile(ctx context.Context, path string, raw []byte, branch, commitMsg string) error\n```\nCommitFile creates a commit on a repo's worktree which overwrites the specified file path with the provided bytes.\n\n```go\nfunc (r *Repository) CreateOrUpdateBranch(ctx context.Context, branchName string) error\n```\nCreateOrUpdateBranch attempts to create a new branch on the fork repo if it doesn't already exist, or rebase it onto HEAD if it does.\n\n```go\nfunc (r *Repository) CreatePR(ctx context.Context, title, commitBranch string) error\n```\nCreatePR creates a pull request. Based on: [https://godoc.org/github.com/google/go-github/github#example-PullRequestsService-Create](https://godoc.org/github.com/google/go-github/github#example-PullRequestsService-Create)\n\n```go\nfunc (r *Repository) ReadFile(ctx context.Context, path string) ([]byte, error)\n```\nReadFile returns the contents of the specified path from the configured upstream repo.\n\n```go\nfunc (r Repository) String() string\n```\n\n","path":"github.com/google/trillian-examples/internal/github","name":"github","synopsis":"Package github contains libraries for using github repositories that make serverless operations easy to follow.","isRedistributable":true}
