Documentation
¶
Overview ¶
Package github implements the forge.IssueTracker interface for GitHub using the google/go-github SDK.
Index ¶
- type Client
- func (c *Client) AddComment(ctx context.Context, number int, body string) (*forge.Comment, error)
- func (c *Client) AddLabel(ctx context.Context, number int, label string) error
- func (c *Client) Assign(ctx context.Context, number int, assignee string) error
- func (c *Client) CreateBranch(ctx context.Context, name string) error
- func (c *Client) CreateIssue(ctx context.Context, req *forge.CreateIssueRequest) (*forge.Issue, error)
- func (c *Client) CreateOrUpdateFile(ctx context.Context, branch, path, content, message string) error
- func (c *Client) CreatePullRequest(ctx context.Context, req *forge.CreatePRRequest) (*forge.PullRequest, error)
- func (c *Client) GetCommitLog(ctx context.Context, branch string, limit int) ([]forge.Commit, error)
- func (c *Client) GetDiff(ctx context.Context, base, head string) (string, error)
- func (c *Client) GetIssue(ctx context.Context, number int) (*forge.Issue, error)
- func (c *Client) GetPullRequest(ctx context.Context, number int) (*forge.PullRequest, error)
- func (c *Client) ListBranches(ctx context.Context) ([]forge.Branch, error)
- func (c *Client) ListComments(ctx context.Context, number int) ([]*forge.Comment, error)
- func (c *Client) ListFiles(ctx context.Context, path, ref string) ([]forge.FileEntry, error)
- func (c *Client) ListIssues(ctx context.Context, opts *forge.ListOptions) ([]*forge.Issue, error)
- func (c *Client) ListPullRequests(ctx context.Context, opts *forge.ListPROptions) ([]*forge.PullRequest, error)
- func (c *Client) MergePullRequest(ctx context.Context, number int, method forge.MergeMethod, commitMsg string) error
- func (c *Client) ReadFile(ctx context.Context, path, ref string) ([]byte, error)
- func (c *Client) RemoveLabel(ctx context.Context, number int, label string) error
- func (c *Client) SearchCode(ctx context.Context, query string) ([]forge.SearchResult, error)
- func (c *Client) SetBaseURL(url string)
- func (c *Client) SetLabels(ctx context.Context, number int, labels []string) error
- func (c *Client) SetPollInterval(d time.Duration)
- func (c *Client) Unassign(ctx context.Context, number int, assignee string) error
- func (c *Client) UpdateIssue(ctx context.Context, number int, req *forge.UpdateIssueRequest) (*forge.Issue, error)
- func (c *Client) Watch(ctx context.Context, handler func(forge.Event)) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements forge.IssueTracker for GitHub repositories.
func New ¶
New creates a GitHub IssueTracker client for the given owner/repo. The httpClient should carry authentication (e.g., via oauth2.TokenSource). If httpClient is nil, unauthenticated requests are made (60 req/hr limit).
func (*Client) AddComment ¶
AddComment posts a new comment on the given issue.
func (*Client) CreateBranch ¶ added in v0.1.5
CreateBranch creates a new branch from the default branch HEAD.
func (*Client) CreateIssue ¶
func (c *Client) CreateIssue(ctx context.Context, req *forge.CreateIssueRequest) (*forge.Issue, error)
CreateIssue creates a new issue on the repository.
func (*Client) CreateOrUpdateFile ¶ added in v0.1.5
func (c *Client) CreateOrUpdateFile(ctx context.Context, branch, path, content, message string) error
CreateOrUpdateFile creates or updates a file on the given branch.
func (*Client) CreatePullRequest ¶
func (c *Client) CreatePullRequest(ctx context.Context, req *forge.CreatePRRequest) (*forge.PullRequest, error)
CreatePullRequest creates a new pull request on the repository.
func (*Client) GetCommitLog ¶
func (c *Client) GetCommitLog(ctx context.Context, branch string, limit int) ([]forge.Commit, error)
GetCommitLog returns the most recent commits on a branch. If branch is empty, "main" is used. Limit defaults to 20 if <= 0.
func (*Client) GetDiff ¶
GetDiff returns the diff between two refs (branches, tags, or commit SHAs).
func (*Client) GetPullRequest ¶
GetPullRequest retrieves a single pull request by number.
func (*Client) ListBranches ¶
ListBranches returns all branches in the repository.
func (*Client) ListComments ¶
ListComments returns all comments on the given issue.
func (*Client) ListFiles ¶
ListFiles returns the files and directories at the given path and ref. If path is empty, the repository root is listed. If ref is empty, the default branch is used.
func (*Client) ListIssues ¶
ListIssues returns issues matching the given filter options.
func (*Client) ListPullRequests ¶
func (c *Client) ListPullRequests(ctx context.Context, opts *forge.ListPROptions) ([]*forge.PullRequest, error)
ListPullRequests returns pull requests matching the given filter options.
func (*Client) MergePullRequest ¶
func (c *Client) MergePullRequest(ctx context.Context, number int, method forge.MergeMethod, commitMsg string) error
MergePullRequest merges a pull request using the specified method.
func (*Client) ReadFile ¶
ReadFile returns the contents of the file at the given path and ref. If ref is empty, the default branch is used. Uses GetContents which returns base64-encoded content (limited to 1 MB files).
func (*Client) RemoveLabel ¶
RemoveLabel removes a single label from the given issue.
func (*Client) SearchCode ¶
SearchCode searches for code matching the query within this repository.
func (*Client) SetBaseURL ¶
SetBaseURL overrides the GitHub API base URL (useful for GitHub Enterprise or test servers). The URL must include a trailing slash.
func (*Client) SetPollInterval ¶
SetPollInterval configures the polling interval for Watch.
func (*Client) UpdateIssue ¶
func (c *Client) UpdateIssue(ctx context.Context, number int, req *forge.UpdateIssueRequest) (*forge.Issue, error)
UpdateIssue modifies an existing issue. Nil fields in the request are left unchanged.