Documentation
¶
Index ¶
- Constants
- func BranchSliceToNameSlice(branches []*github.Branch) []string
- func CanMerge(pr *github.PullRequest) bool
- func Environments(repo api.Repository, githubClient *github.Client) ([]api.CIEnvironment, error)
- func GetMergeRequest(client *github.Client, repo api.Repository, number int) (api.MergeRequest, error)
- func HeadFilter(owner string, branch string) string
- func IsNotFound(resp *github.Response) bool
- func ListMergeRequests(client *github.Client, repo api.Repository, ...) ([]api.MergeRequest, error)
- func Merge(client *github.Client, repo api.Repository, mergeRequest api.MergeRequest, ...) error
- func MergeRequestDiff(client *github.Client, repo api.Repository, mergeRequest api.MergeRequest) (api.MergeRequestDiff, error)
- func RoundTripperToAccessToken(rt http.RoundTripper) (string, error)
- func SubmitReview(client *github.Client, repo api.Repository, mergeRequest api.MergeRequest, ...) error
- func ToMergeMethod(mergeStrategyOptions api.MergeStrategyOptions) string
- func ToMergeRequestLabels(labels []*github.Label) []string
- func ToStandardMergeRequest(pr *github.PullRequest, repo api.Repository) api.MergeRequest
- func ToStandardMergeRequestState(state string) api.MergeRequestState
- func ToStandardUser(user *github.User) api.User
- func Variables(repo api.Repository, githubClient *github.Client) ([]api.CIVariable, error)
- func WrapGetRepositoryError(ref any, resp *github.Response, err error) error
- func WrapMergeError(repo api.Repository, mergeRequest api.MergeRequest, resp *github.Response, ...) error
Constants ¶
const PageSize = 100
Variables ¶
This section is empty.
Functions ¶
func BranchSliceToNameSlice ¶
BranchSliceToNameSlice converts a slice of branches to a slice of branch names
func CanMerge ¶
func CanMerge(pr *github.PullRequest) bool
CanMerge reports whether a pull request is mergeable, blocked / behind / dirty / draft / unknown states report false. The mergeability is only provided by the single pull request endpoint and computed asynchronously, nil is treated as "not mergeable yet".
func Environments ¶
func Environments(repo api.Repository, githubClient *github.Client) ([]api.CIEnvironment, error)
func GetMergeRequest ¶
func GetMergeRequest(client *github.Client, repo api.Repository, number int) (api.MergeRequest, error)
GetMergeRequest fetches a single pull request by number, including its mergeability
func HeadFilter ¶
HeadFilter returns the head filter for the pull request list endpoint, GitHub requires the format owner:branch (a bare branch name is ignored)
func IsNotFound ¶
IsNotFound reports whether a GitHub API response is a 404
func ListMergeRequests ¶
func ListMergeRequests(client *github.Client, repo api.Repository, options api.MergeRequestSearchOptions) ([]api.MergeRequest, error)
ListMergeRequests lists all pull requests of a repository matching the search options
func Merge ¶
func Merge(client *github.Client, repo api.Repository, mergeRequest api.MergeRequest, mergeStrategy api.MergeStrategyOptions) error
Merge merges a pull request by number
func MergeRequestDiff ¶
func MergeRequestDiff(client *github.Client, repo api.Repository, mergeRequest api.MergeRequest) (api.MergeRequestDiff, error)
MergeRequestDiff returns all changed files of a pull request
func RoundTripperToAccessToken ¶
func RoundTripperToAccessToken(rt http.RoundTripper) (string, error)
RoundTripperToAccessToken takes a ghinstallation round-tripper and obtains a new access token
func SubmitReview ¶
func SubmitReview(client *github.Client, repo api.Repository, mergeRequest api.MergeRequest, approved bool, message *string) error
SubmitReview approves or requests changes on a pull request
func ToMergeMethod ¶
func ToMergeMethod(mergeStrategyOptions api.MergeStrategyOptions) string
func ToMergeRequestLabels ¶
func ToStandardMergeRequest ¶
func ToStandardMergeRequest(pr *github.PullRequest, repo api.Repository) api.MergeRequest
ToStandardMergeRequest converts a GitHub pull request into an api.MergeRequest
func ToStandardMergeRequestState ¶
func ToStandardMergeRequestState(state string) api.MergeRequestState
func Variables ¶
func Variables(repo api.Repository, githubClient *github.Client) ([]api.CIVariable, error)
func WrapGetRepositoryError ¶
WrapGetRepositoryError wraps a repository lookup error, mapping 404 responses to api.ErrRepositoryNotFound
func WrapMergeError ¶
func WrapMergeError(repo api.Repository, mergeRequest api.MergeRequest, resp *github.Response, err error) error
WrapMergeError classifies a merge error by status code, see https://docs.github.com/en/rest/pulls/pulls#merge-a-pull-request
Types ¶
This section is empty.