Documentation
¶
Index ¶
- func ContainsSkipCI(s string) bool
- func FilterIgnorePath(files []string, pattern string) ([]string, error)
- func FilterPath(files []string, pattern string) ([]string, error)
- func IsInsidePath(parent, child string) bool
- type ChangedFileObject
- type CheckRequest
- type CheckResponse
- type CommitObject
- type GetParameters
- type GetRequest
- type GetResponse
- 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) 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) RevParse(branch string) (string, error)
- type Github
- type GithubClient
- func (m *GithubClient) DeletePreviousComments(prNumber string) error
- func (m *GithubClient) GetChangedFiles(prNumber string, commitRef string) ([]ChangedFileObject, error)
- func (m *GithubClient) GetPullRequest(prNumber, 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, comment string) error
- func (m *GithubClient) UpdateCommitStatus(commitRef, baseContext, statusContext, status, targetURL, description string) error
- type LabelObject
- type Metadata
- type MetadataField
- type PullRequest
- type PullRequestObject
- type PutParameters
- type PutRequest
- type PutResponse
- type Source
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsSkipCI ¶
ContainsSkipCI returns true if a string contains [ci skip] or [skip ci].
func FilterIgnorePath ¶
FilterIgnorePath ...
func IsInsidePath ¶ added in v0.10.0
IsInsidePath checks whether the child path is inside the parent path.
/foo/bar is inside /foo, but /foobar is not inside /foo. /foo is inside /foo, but /foo is not inside /foo/
Types ¶
type ChangedFileObject ¶ added in v0.17.0
type ChangedFileObject struct {
Path string
}
ChangedFileObject represents the GraphQL FilesChanged node. https://developer.github.com/v4/object/pullrequestchangedfile/
type CheckRequest ¶
CheckRequest ...
type CheckResponse ¶
type CheckResponse []Version
CheckResponse ...
func Check ¶
func Check(request CheckRequest, manager Github) (CheckResponse, error)
Check (business logic)
func (CheckResponse) Len ¶
func (r CheckResponse) Len() int
func (CheckResponse) Less ¶
func (r CheckResponse) Less(i, j int) bool
func (CheckResponse) Swap ¶
func (r CheckResponse) Swap(i, j int)
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 GetParameters ¶
type GetParameters struct {
SkipDownload bool `json:"skip_download"`
IntegrationTool string `json:"integration_tool"`
GitDepth int `json:"git_depth"`
Submodules bool `json:"submodules"`
ListChangedFiles bool `json:"list_changed_files"`
FetchTags bool `json:"fetch_tags"`
}
GetParameters ...
type GetRequest ¶
type GetRequest struct {
Source Source `json:"source"`
Version Version `json:"version"`
Params GetParameters `json:"params"`
}
GetRequest ...
type GetResponse ¶
type GetResponse struct {
Version Version `json:"version"`
Metadata Metadata `json:"metadata,omitempty"`
}
GetResponse ...
func Get ¶
func Get(request GetRequest, github Github, git Git, outputDir string) (*GetResponse, error)
Get (business logic)
type Git ¶
type Git interface {
Init(string) error
Pull(string, string, int, bool, bool) error
RevParse(string) (string, error)
Fetch(string, int, int, 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 ¶
NewGitClient ...
func (*GitClient) Endpoint ¶
Endpoint takes an uri and produces an endpoint with the login information baked in.
func (*GitClient) GitCryptUnlock ¶ added in v0.12.0
GitCryptUnlock unlocks the repository using git-crypt
type Github ¶
type Github interface {
ListPullRequests([]githubv4.PullRequestState) ([]*PullRequest, error)
ListModifiedFiles(int) ([]string, error)
PostComment(string, string) error
GetPullRequest(string, string) (*PullRequest, error)
GetChangedFiles(string, string) ([]ChangedFileObject, error)
UpdateCommitStatus(string, string, string, string, string, string) error
DeletePreviousComments(string) error
}
Github for testing purposes.
type GithubClient ¶
GithubClient for handling requests to the Github V3 and V4 APIs.
func (*GithubClient) DeletePreviousComments ¶ added in v0.19.0
func (m *GithubClient) DeletePreviousComments(prNumber string) error
func (*GithubClient) GetChangedFiles ¶ added in v0.17.0
func (m *GithubClient) GetChangedFiles(prNumber string, commitRef string) ([]ChangedFileObject, error)
GetChangedFiles ...
func (*GithubClient) GetPullRequest ¶ added in v0.5.0
func (m *GithubClient) GetPullRequest(prNumber, 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 ¶ added in v0.23.0
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, 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 LabelObject ¶ added in v0.19.0
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 ¶ added in v0.22.0
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/
type PutParameters ¶
type PutParameters struct {
Path string `json:"path"`
BaseContext string `json:"base_context"`
Context string `json:"context"`
TargetURL string `json:"target_url"`
DescriptionFile string `json:"description_file"`
Description string `json:"description"`
Status string `json:"status"`
CommentFile string `json:"comment_file"`
Comment string `json:"comment"`
DeletePreviousComments bool `json:"delete_previous_comments"`
}
PutParameters for the resource.
func (*PutParameters) Validate ¶
func (p *PutParameters) Validate() error
Validate the put parameters.
type PutRequest ¶
type PutRequest struct {
Source Source `json:"source"`
Params PutParameters `json:"params"`
}
PutRequest ...
type PutResponse ¶
type PutResponse struct {
Version Version `json:"version"`
Metadata Metadata `json:"metadata,omitempty"`
}
PutResponse ...
func Put ¶
func Put(request PutRequest, manager Github, inputDir string) (*PutResponse, error)
Put (business logic)
type Source ¶
type Source struct {
Repository string `json:"repository"`
AccessToken string `json:"access_token"`
V3Endpoint string `json:"v3_endpoint"`
V4Endpoint string `json:"v4_endpoint"`
Paths []string `json:"paths"`
IgnorePaths []string `json:"ignore_paths"`
DisableCISkip bool `json:"disable_ci_skip"`
DisableGitLFS bool `json:"disable_git_lfs"`
SkipSSLVerification bool `json:"skip_ssl_verification"`
DisableForks bool `json:"disable_forks"`
IgnoreDrafts bool `json:"ignore_drafts"`
GitCryptKey string `json:"git_crypt_key"`
BaseBranch string `json:"base_branch"`
RequiredReviewApprovals int `json:"required_review_approvals"`
Labels []string `json:"labels"`
States []githubv4.PullRequestState `json:"states"`
}
Source represents the configuration for the resource.