Documentation
¶
Overview ¶
Package github provides a wrapper around the go-github client for interacting with the GitHub API.
Index ¶
- type Client
- func (c *Client) AddLabel(ctx context.Context, number int, labels []string) error
- func (c *Client) CloseIssue(ctx context.Context, number int) error
- func (c *Client) CommentOnIssue(ctx context.Context, number int, body string) error
- func (c *Client) CreateIssue(ctx context.Context, title, body string, labels []string) (*github.Issue, error)
- func (c *Client) DeleteBranch(ctx context.Context, branchName string) error
- func (c *Client) DeleteFile(ctx context.Context, path, message string) error
- func (c *Client) GetFileContent(ctx context.Context, path string) (string, error)
- func (c *Client) GetIssueContent(ctx context.Context, number int) (string, error)
- func (c *Client) GetPR(ctx context.Context, number int) (*github.PullRequest, error)
- func (c *Client) GetPRStatus(ctx context.Context, ref string) (string, error)
- func (c *Client) ListFiles(ctx context.Context, path string) ([]string, error)
- func (c *Client) ListOpenIssuesByLabel(ctx context.Context, label string) ([]*github.Issue, error)
- func (c *Client) ListOpenPullRequests(ctx context.Context) ([]*github.PullRequest, error)
- func (c *Client) MergePR(ctx context.Context, number int) error
- func (c *Client) SpecHasGapAnalysis(ctx context.Context, specID int, gapLabel string) bool
- type ClientInterface
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 encapsulates the GitHub API client and repository context.
func NewClient ¶
func NewClient(ctx context.Context, token, repoFullName string, interval time.Duration) (*Client, error)
NewClient creates a new GitHub client for specific repository. token is the GitHub Personal Access Token. repoFullName is the repository in "owner/repo" format.
func (*Client) CloseIssue ¶
CloseIssue closes an issue
func (*Client) CommentOnIssue ¶
CommentOnIssue adds a comment to an issue
func (*Client) CreateIssue ¶
func (c *Client) CreateIssue(ctx context.Context, title, body string, labels []string) (*github.Issue, error)
CreateIssue creates a new issue in the repository.
func (*Client) DeleteBranch ¶
DeleteBranch deletes a branch in the repository
func (*Client) DeleteFile ¶
DeleteFile deletes a file from the repository
func (*Client) GetFileContent ¶
GetFileContent reads a file from the repository (default branch)
func (*Client) GetIssueContent ¶
GetIssueContent returns the body of a specific issue
func (*Client) GetPRStatus ¶
GetPRStatus checks the combined status of a Ref (Head SHA of PR)
func (*Client) ListOpenIssuesByLabel ¶
ListOpenIssuesByLabel returns all open issues with the given label
func (*Client) ListOpenPullRequests ¶
ListOpenPullRequests returns all open pull requests
type ClientInterface ¶
type ClientInterface interface {
ListOpenIssuesByLabel(ctx context.Context, label string) ([]*github.Issue, error)
ListOpenPullRequests(ctx context.Context) ([]*github.PullRequest, error)
CreateIssue(ctx context.Context, title, body string, labels []string) (*github.Issue, error)
AddLabel(ctx context.Context, number int, labels []string) error
SpecHasGapAnalysis(ctx context.Context, specID int, gapLabel string) bool
GetIssueContent(ctx context.Context, number int) (string, error)
CommentOnIssue(ctx context.Context, number int, body string) error
CloseIssue(ctx context.Context, number int) error
MergePR(ctx context.Context, number int) error
GetPRStatus(ctx context.Context, ref string) (string, error)
GetPR(ctx context.Context, number int) (*github.PullRequest, error)
GetFileContent(ctx context.Context, path string) (string, error)
ListFiles(ctx context.Context, path string) ([]string, error)
DeleteBranch(ctx context.Context, branchName string) error
DeleteFile(ctx context.Context, path, message string) error
}
ClientInterface defines the methods required for interacting with GitHub. This interface allows for mocking in tests.