Documentation ¶
Index ¶
- type GithubClient
- func (gc *GithubClient) AddLabelsToIssue(org, repo string, issueNumber int, labels []string) error
- func (gc *GithubClient) CloseIssue(org, repo string, issueNumber int) error
- func (gc *GithubClient) CreateComment(org, repo string, issueNumber int, commentBody string) (*github.IssueComment, error)
- func (gc *GithubClient) CreateIssue(org, repo, title, body string) (*github.Issue, error)
- func (gc *GithubClient) CreatePullRequest(org, repo, head, base, title, body string) (*github.PullRequest, error)
- func (gc *GithubClient) DeleteComment(org, repo string, commentID int64) error
- func (gc *GithubClient) EditComment(org, repo string, commentID int64, commentBody string) error
- func (gc *GithubClient) EditPullRequest(org, repo string, ID int, title, body string) (*github.PullRequest, error)
- func (gc *GithubClient) EnsureLabelForPullRequest(org, repo string, ID int, label string) error
- func (gc *GithubClient) GetComment(org, repo string, commentID int64) (*github.IssueComment, error)
- func (gc *GithubClient) GetGithubUser() (*github.User, error)
- func (gc *GithubClient) GetPullRequest(org, repo string, ID int) (*github.PullRequest, error)
- func (gc *GithubClient) GetPullRequestByCommitID(org, repo, commitID string) (*github.PullRequest, error)
- func (gc *GithubClient) ListBranches(org, repo string) ([]*github.Branch, error)
- func (gc *GithubClient) ListComments(org, repo string, issueNumber int) ([]*github.IssueComment, error)
- func (gc *GithubClient) ListCommits(org, repo string, ID int) ([]*github.RepositoryCommit, error)
- func (gc *GithubClient) ListFiles(org, repo string, ID int) ([]*github.CommitFile, error)
- func (gc *GithubClient) ListIssuesByRepo(org, repo string, labels []string) ([]*github.Issue, error)
- func (gc *GithubClient) ListPullRequests(org, repo, head, base string) ([]*github.PullRequest, error)
- func (gc *GithubClient) ListRepos(org string) ([]string, error)
- func (gc *GithubClient) ListWorkflows(org, repo string) ([]*github.Workflow, error)
- func (gc *GithubClient) RemoveLabelForIssue(org, repo string, issueNumber int, label string) error
- func (gc *GithubClient) ReopenIssue(org, repo string, issueNumber int) error
- type GithubOperations
- type IssueStateEnum
- type PullRequestState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GithubClient ¶
GithubClient provides methods to perform github operations It implements all functions in GithubOperations
func NewGithubClient ¶
func NewGithubClient(tokenFilePath string) (*GithubClient, error)
NewGithubClient explicitly authenticates to github with giving token and returns a handle. If tokenFilePath is empty, NewGithubClient will attempt to use the value in the environment `GITHUB_TOKEN`.
func (*GithubClient) AddLabelsToIssue ¶
func (gc *GithubClient) AddLabelsToIssue(org, repo string, issueNumber int, labels []string) error
AddLabelsToIssue adds label on issue
func (*GithubClient) CloseIssue ¶
func (gc *GithubClient) CloseIssue(org, repo string, issueNumber int) error
CloseIssue closes issue
func (*GithubClient) CreateComment ¶
func (gc *GithubClient) CreateComment(org, repo string, issueNumber int, commentBody string) (*github.IssueComment, error)
CreateComment adds comment to issue
func (*GithubClient) CreateIssue ¶
func (gc *GithubClient) CreateIssue(org, repo, title, body string) (*github.Issue, error)
CreateIssue creates issue
func (*GithubClient) CreatePullRequest ¶
func (gc *GithubClient) CreatePullRequest(org, repo, head, base, title, body string) (*github.PullRequest, error)
CreatePullRequest creates PullRequest, passing head user and branch name "user:ref-name", and base branch name like "main"
func (*GithubClient) DeleteComment ¶
func (gc *GithubClient) DeleteComment(org, repo string, commentID int64) error
DeleteComment deletes comment from issue
func (*GithubClient) EditComment ¶
func (gc *GithubClient) EditComment(org, repo string, commentID int64, commentBody string) error
EditComment edits comment by replacing with provided comment
func (*GithubClient) EditPullRequest ¶
func (gc *GithubClient) EditPullRequest(org, repo string, ID int, title, body string) (*github.PullRequest, error)
EditPullRequest updates PullRequest
func (*GithubClient) EnsureLabelForPullRequest ¶
func (gc *GithubClient) EnsureLabelForPullRequest(org, repo string, ID int, label string) error
EnsureLabelForPullRequest ensures the label exists for the given PullRequest.
func (*GithubClient) GetComment ¶
func (gc *GithubClient) GetComment(org, repo string, commentID int64) (*github.IssueComment, error)
GetComment gets comment by comment ID
func (*GithubClient) GetGithubUser ¶
func (gc *GithubClient) GetGithubUser() (*github.User, error)
GetGithubUser gets current authenticated user
func (*GithubClient) GetPullRequest ¶
func (gc *GithubClient) GetPullRequest(org, repo string, ID int) (*github.PullRequest, error)
GetPullRequest gets PullRequest by ID
func (*GithubClient) GetPullRequestByCommitID ¶
func (gc *GithubClient) GetPullRequestByCommitID(org, repo, commitID string) (*github.PullRequest, error)
GetPullRequestByCommitID gets PullRequest by commit ID
func (*GithubClient) ListBranches ¶
func (gc *GithubClient) ListBranches(org, repo string) ([]*github.Branch, error)
ListBranches lists branchs for given repo
func (*GithubClient) ListComments ¶
func (gc *GithubClient) ListComments(org, repo string, issueNumber int) ([]*github.IssueComment, error)
ListComments gets all comments from issue
func (*GithubClient) ListCommits ¶
func (gc *GithubClient) ListCommits(org, repo string, ID int) ([]*github.RepositoryCommit, error)
ListCommits lists commits from a pull request
func (*GithubClient) ListFiles ¶
func (gc *GithubClient) ListFiles(org, repo string, ID int) ([]*github.CommitFile, error)
ListFiles lists files from a pull request
func (*GithubClient) ListIssuesByRepo ¶
func (gc *GithubClient) ListIssuesByRepo(org, repo string, labels []string) ([]*github.Issue, error)
ListIssuesByRepo lists issues within given repo, filters by labels if provided
func (*GithubClient) ListPullRequests ¶
func (gc *GithubClient) ListPullRequests(org, repo, head, base string) ([]*github.PullRequest, error)
ListPullRequests lists pull requests within given repo, filters by head user and branch name if provided as "user:ref-name", and by base name if provided, i.e. "main"
func (*GithubClient) ListRepos ¶
func (gc *GithubClient) ListRepos(org string) ([]string, error)
ListRepos lists repos under org
func (*GithubClient) ListWorkflows ¶
func (gc *GithubClient) ListWorkflows(org, repo string) ([]*github.Workflow, error)
ListWorkflows lists workflows for a given org/repo.
func (*GithubClient) RemoveLabelForIssue ¶
func (gc *GithubClient) RemoveLabelForIssue(org, repo string, issueNumber int, label string) error
RemoveLabelForIssue removes given label for issue
func (*GithubClient) ReopenIssue ¶
func (gc *GithubClient) ReopenIssue(org, repo string, issueNumber int) error
ReopenIssue reopen issue
type GithubOperations ¶
type GithubOperations interface { GetGithubUser() (*github.User, error) ListRepos(org string) ([]string, error) ListIssuesByRepo(org, repo string, labels []string) ([]*github.Issue, error) CreateIssue(org, repo, title, body string) (*github.Issue, error) CloseIssue(org, repo string, issueNumber int) error ReopenIssue(org, repo string, issueNumber int) error ListComments(org, repo string, issueNumber int) ([]*github.IssueComment, error) GetComment(org, repo string, commentID int64) (*github.IssueComment, error) CreateComment(org, repo string, issueNumber int, commentBody string) (*github.IssueComment, error) EditComment(org, repo string, commentID int64, commentBody string) error DeleteComment(org, repo string, commentID int64) error AddLabelsToIssue(org, repo string, issueNumber int, labels []string) error RemoveLabelForIssue(org, repo string, issueNumber int, label string) error GetPullRequest(org, repo string, ID int) (*github.PullRequest, error) GetPullRequestByCommitID(org, repo, commitID string) (*github.PullRequest, error) EditPullRequest(org, repo string, ID int, title, body string) (*github.PullRequest, error) ListPullRequests(org, repo, head, base string) ([]*github.PullRequest, error) ListCommits(org, repo string, ID int) ([]*github.RepositoryCommit, error) ListFiles(org, repo string, ID int) ([]*github.CommitFile, error) CreatePullRequest(org, repo, head, base, title, body string) (*github.PullRequest, error) EnsureLabelForPullRequest(org, repo string, ID int, label string) error ListBranches(org, repo string) ([]*github.Branch, error) }
GithubOperations contains a set of functions for Github operations
type IssueStateEnum ¶
type IssueStateEnum string
IssueStateEnum represents different states of Github Issues
const ( // IssueOpenState is the state of open github issue IssueOpenState IssueStateEnum = "open" // IssueCloseState is the state of closed github issue IssueCloseState IssueStateEnum = "closed" // IssueAllState is the state for all, useful when querying issues IssueAllState IssueStateEnum = "all" )
type PullRequestState ¶
type PullRequestState string
PullRequestState represents different states of PullRequest
const ( // PullRequestOpenState is the state of open PullRequest PullRequestOpenState PullRequestState = "open" // PullRequestCloseState is the state of closed PullRequest PullRequestCloseState PullRequestState = "closed" // PullRequestAllState is the state for all, useful when querying PullRequest PullRequestAllState PullRequestState = "all" )