Documentation
¶
Overview ¶
Package github provides operations on GitHub repos, abstracting away go-github (at least somewhat) to only the operations Librarian needs.
Index ¶
- type Client
- func (c *Client) AddLabelsToIssue(ctx context.Context, repo *Repository, number int, labels []string) error
- func (c *Client) ClosePullRequest(ctx context.Context, number int) error
- func (c *Client) CreateIssueComment(ctx context.Context, number int, comment string) error
- func (c *Client) CreatePullRequest(ctx context.Context, repo *Repository, ...) (*PullRequestMetadata, error)
- func (c *Client) CreateRelease(ctx context.Context, tagName, name, body, commitish string) (*github.RepositoryRelease, error)
- func (c *Client) CreateTag(ctx context.Context, tagName, commitSHA string) error
- func (c *Client) FindMergedPullRequestsWithLabel(ctx context.Context, owner, repo, label string) ([]*PullRequest, error)
- func (c *Client) FindMergedPullRequestsWithPendingReleaseLabel(ctx context.Context, owner, repo string) ([]*PullRequest, error)
- func (c *Client) GetLabels(ctx context.Context, number int) ([]string, error)
- func (c *Client) GetPullRequest(ctx context.Context, number int) (*PullRequest, error)
- func (c *Client) GetRawContent(ctx context.Context, path, ref string) ([]byte, error)
- func (c *Client) ReplaceLabels(ctx context.Context, number int, labels []string) error
- func (c *Client) SearchPullRequests(ctx context.Context, query string) ([]*PullRequest, error)
- func (c *Client) Token() string
- type NewPullRequest
- type PullRequest
- type PullRequestMetadata
- type PullRequestReview
- type Repository
- type RepositoryCommit
- type RepositoryRelease
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client represents this package's abstraction of a GitHub client, including an access token.
func NewClient ¶
func NewClient(accessToken string, repo *Repository) *Client
NewClient creates a new Client to interact with GitHub.
func (*Client) AddLabelsToIssue ¶ added in v0.2.0
func (c *Client) AddLabelsToIssue(ctx context.Context, repo *Repository, number int, labels []string) error
AddLabelsToIssue adds labels to an existing issue in a GitHub repository.
func (*Client) ClosePullRequest ¶ added in v0.2.0
ClosePullRequest closes the pull request specified by pull request number.
func (*Client) CreateIssueComment ¶ added in v0.2.0
CreateIssueComment adds a comment to the issue number provided.
func (*Client) CreatePullRequest ¶
func (c *Client) CreatePullRequest(ctx context.Context, repo *Repository, remoteBranch, baseBranch, title, body string, isDraft bool) (*PullRequestMetadata, error)
CreatePullRequest creates a pull request in the remote repo. At the moment this requires a single remote to be configured, which must have a GitHub HTTPS URL. We assume a base branch of "main".
func (*Client) CreateRelease ¶
func (c *Client) CreateRelease(ctx context.Context, tagName, name, body, commitish string) (*github.RepositoryRelease, error)
CreateRelease creates a tag and release in the repository at the given commit-ish. See https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-commit-ishalsocommittish for definition of commit-ish.
func (*Client) CreateTag ¶ added in v0.2.0
CreateTag creates a lightweight tag in the repository at the given commit SHA. This does NOT create a release, just the tag.
func (*Client) FindMergedPullRequestsWithLabel ¶ added in v0.3.0
func (c *Client) FindMergedPullRequestsWithLabel(ctx context.Context, owner, repo, label string) ([]*PullRequest, error)
FindMergedPullRequestsWithLabel finds all merged pull requests with the "release:pending" label.
func (*Client) FindMergedPullRequestsWithPendingReleaseLabel ¶ added in v0.2.0
func (c *Client) FindMergedPullRequestsWithPendingReleaseLabel(ctx context.Context, owner, repo string) ([]*PullRequest, error)
FindMergedPullRequestsWithPendingReleaseLabel finds all merged pull requests with the "release:pending" label.
func (*Client) GetPullRequest ¶
GetPullRequest gets a pull request by its number.
func (*Client) GetRawContent ¶
GetRawContent fetches the raw content of a file within a repository repo, identifying the file by path, at a specific commit/tag/branch of ref.
func (*Client) ReplaceLabels ¶ added in v0.2.0
ReplaceLabels replaces all labels for an issue.
func (*Client) SearchPullRequests ¶ added in v0.2.0
SearchPullRequests searches for pull requests in the repository using the provided raw query.
type NewPullRequest ¶ added in v0.2.0
type NewPullRequest = github.NewPullRequest
NewPullRequest is a type alias for the go-github type.
type PullRequest ¶
type PullRequest = github.PullRequest
PullRequest is a type alias for the go-github type.
type PullRequestMetadata ¶
type PullRequestMetadata struct {
// Repo is the repository containing the pull request.
Repo *Repository
// Number is the number of the pull request.
Number int
}
PullRequestMetadata identifies a pull request within a repository.
type PullRequestReview ¶
type PullRequestReview = github.PullRequestReview
PullRequestReview is a type alias for the go-github type.
type Repository ¶
type Repository struct {
// The owner of the repository.
Owner string
// The name of the repository.
Name string
// Base URL for API requests.
BaseURL string
}
Repository represents a GitHub repository with an owner (e.g. an organization or a user) and a repository name.
func ParseRemote ¶ added in v0.2.0
func ParseRemote(remote string) (*Repository, error)
ParseRemote parses a GitHub remote (anything to do with a repository) to determine the GitHub repo details (owner and name).
type RepositoryCommit ¶
type RepositoryCommit = github.RepositoryCommit
RepositoryCommit is a type alias for the go-github type.
type RepositoryRelease ¶ added in v0.2.0
type RepositoryRelease = github.RepositoryRelease
RepositoryRelease is a type alias for the go-github type.