githubcommon

package
v0.0.0-...-1d2b55d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const PageSize = 100

Variables

This section is empty.

Functions

func BranchSliceToNameSlice

func BranchSliceToNameSlice(branches []*github.Branch) []string

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

func HeadFilter(owner string, branch string) string

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

func IsNotFound(resp *github.Response) bool

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 ToMergeRequestLabels(labels []*github.Label) []string

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 ToStandardUser

func ToStandardUser(user *github.User) api.User

func Variables

func Variables(repo api.Repository, githubClient *github.Client) ([]api.CIVariable, error)

func WrapGetRepositoryError

func WrapGetRepositoryError(ref any, resp *github.Response, err error) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL