Documentation
¶
Index ¶
- type ChangedFileObject
- type CommitObject
- type CommonConfig
- type Git
- type GitClient
- func (g *GitClient) Checkout(branch, sha string, submodules bool) error
- func (g *GitClient) Endpoint(uri string) (string, error)
- func (g *GitClient) Fetch(uri string, prNumber int, depth int, submodules bool, checkout bool) error
- func (g *GitClient) GitCryptUnlock(base64key string) error
- func (g *GitClient) Init(branch *string) error
- func (g *GitClient) Merge(sha string, submodules bool) error
- func (g *GitClient) Pull(uri, branch string, depth int, submodules bool, fetchTags bool) error
- func (g *GitClient) Rebase(baseRef string, headSha string, submodules bool) error
- func (g *GitClient) RevList(fromCommit *string, paths []string, ignorePaths []string, disableCISkip bool) ([]string, error)
- func (g *GitClient) RevParse(branch string) (string, error)
- type Github
- type GithubClient
- func (m *GithubClient) DeletePreviousComments(prNumber int) error
- func (m *GithubClient) GetPullRequest(prNumber int, commitRef string) (*PullRequest, error)
- func (m *GithubClient) ListModifiedFiles(prNumber int) ([]string, error)
- func (m *GithubClient) ListPullRequests(prStates []githubv4.PullRequestState) ([]*PullRequest, error)
- func (m *GithubClient) PostComment(prNumber int, comment string) error
- func (m *GithubClient) UpdateCommitStatus(commitRef, baseContext, statusContext, status, targetURL, description string) error
- type GithubConfig
- type LabelObject
- type Metadata
- type MetadataField
- type PullRequest
- type PullRequestObject
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangedFileObject ¶
type ChangedFileObject struct {
Path string
}
ChangedFileObject represents the GraphQL FilesChanged node. https://developer.github.com/v4/object/pullrequestchangedfile/
type CommitObject ¶
type CommitObject struct {
ID string
OID string
CommittedDate githubv4.DateTime
Message string
Author struct {
User struct {
Login string
}
Email string
}
}
CommitObject represents the GraphQL commit node. https://developer.github.com/v4/object/commit/
type CommonConfig ¶
type Git ¶
type Git interface {
Init(*string) error
Pull(string, string, int, bool, bool) error
RevParse(string) (string, error)
RevList(*string, []string, []string, bool) ([]string, error)
Fetch(string, int, int, bool, bool) error
Checkout(string, string, bool) error
Merge(string, bool) error
Rebase(string, string, bool) error
GitCryptUnlock(string) error
}
Git interface for testing purposes.
type GitClient ¶
GitClient ...
func NewGitClient ¶
func (*GitClient) Endpoint ¶
Endpoint takes an uri and produces an endpoint with the login information baked in.
func (*GitClient) GitCryptUnlock ¶
GitCryptUnlock unlocks the repository using git-crypt
func (*GitClient) RevList ¶
func (g *GitClient) RevList(fromCommit *string, paths []string, ignorePaths []string, disableCISkip bool) ([]string, error)
RevList retrieves the list of commits starting with (and including) fromCommit (if it exists) in chronological order. If fromCommit is empty or does not exist in the repo, only the latest commit will be returned.
It also
type Github ¶
type Github interface {
ListPullRequests([]githubv4.PullRequestState) ([]*PullRequest, error)
GetPullRequest(int, string) (*PullRequest, error)
ListModifiedFiles(int) ([]string, error)
PostComment(int, string) error
UpdateCommitStatus(string, string, string, string, string, string) error
DeletePreviousComments(int) error
}
Github for testing purposes.
type GithubClient ¶
type GithubClient struct {
HostingEndpoint string
V3 *github.Client
V4 *githubv4.Client
Repository string
Owner string
}
GithubClient for handling requests to the Github V3 and V4 APIs.
func NewGithubClient ¶
func NewGithubClient(common CommonConfig, config GithubConfig) (*GithubClient, error)
NewGithubClient ...
func (*GithubClient) DeletePreviousComments ¶
func (m *GithubClient) DeletePreviousComments(prNumber int) error
func (*GithubClient) GetPullRequest ¶
func (m *GithubClient) GetPullRequest(prNumber int, commitRef string) (*PullRequest, error)
GetPullRequest ...
func (*GithubClient) ListModifiedFiles ¶
func (m *GithubClient) ListModifiedFiles(prNumber int) ([]string, error)
ListModifiedFiles in a pull request (not supported by V4 API).
func (*GithubClient) ListPullRequests ¶
func (m *GithubClient) ListPullRequests(prStates []githubv4.PullRequestState) ([]*PullRequest, error)
ListPullRequests gets the last commit on all pull requests with the matching state.
func (*GithubClient) PostComment ¶
func (m *GithubClient) PostComment(prNumber int, comment string) error
PostComment to a pull request or issue.
func (*GithubClient) UpdateCommitStatus ¶
func (m *GithubClient) UpdateCommitStatus(commitRef, baseContext, statusContext, status, targetURL, description string) error
UpdateCommitStatus for a given commit (not supported by V4 API).
type GithubConfig ¶
type GithubConfig struct {
Repository string `json:"repository"`
HostingEndpoint string `json:"hosting_endpoint"`
V3Endpoint string `json:"v3_endpoint"`
V4Endpoint string `json:"v4_endpoint"`
}
func (GithubConfig) RepositoryURL ¶
func (config GithubConfig) RepositoryURL() string
type LabelObject ¶
type LabelObject struct {
Name string
}
LabelObject represents the GraphQL label node. https://developer.github.com/v4/object/label
type MetadataField ¶
MetadataField ...
type PullRequest ¶
type PullRequest struct {
PullRequestObject
Tip CommitObject
ApprovedReviewCount int
Labels []LabelObject
}
PullRequest represents a pull request and includes the tip (commit).
func (*PullRequest) UpdatedDate ¶
func (p *PullRequest) UpdatedDate() githubv4.DateTime
UpdatedDate returns the last time a PR was updated, either by commit or being closed/merged.
type PullRequestObject ¶
type PullRequestObject struct {
ID string
Number int
Title string
URL string
BaseRefName string
HeadRefName string
Repository struct {
URL string
}
IsCrossRepository bool
IsDraft bool
State githubv4.PullRequestState
ClosedAt githubv4.DateTime
MergedAt githubv4.DateTime
}
PullRequestObject represents the GraphQL commit node. https://developer.github.com/v4/object/pullrequest/