githubclt

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package githubclt provides a github API client.

Index

Constants

View Source
const DefaultHTTPClientTimeout = time.Minute

Variables

View Source
var ErrPullRequestIsClosed = errors.New("pull request is closed")

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an github API client. All methods return a goorderr.RetryableError when an operation can be retried. This can be e.g. the case when the API ratelimit is exceeded.

func New

func New(oauthAPItoken string) *Client

New returns a new github api client.

func (*Client) BranchIsBehindBase added in v0.8.2

func (clt *Client) BranchIsBehindBase(ctx context.Context, owner, repo, base, head string) (behind bool, err error)

BranchIsBehindBase returns true if the head reference contains all changes of base.

func (*Client) PRIsUptodate

func (clt *Client) PRIsUptodate(ctx context.Context, owner, repo string, pullRequestNumber int) (isUptodate bool, headSHA string, err error)

PRIsUptodate returns true if the pull request is open and contains all changes from it's base branch. Additionally it returns the SHA of the head commit for which the status was checked. If the PR is closed ErrPullRequestIsClosed is returned.

func (*Client) RemoveLabel added in v0.11.0

func (clt *Client) RemoveLabel(ctx context.Context, owner, repo string, pullRequestOrIssueNumber int, label string) error

RemoveLabel removes a label from a Pull-Request or issue. If the issue or PR does not have the label, the operation succeeds.

func (*Client) UpdateBranch

func (clt *Client) UpdateBranch(ctx context.Context, owner, repo string, pullRequestNumber int) (*UpdateBranchResult, error)

UpdateBranch schedules merging the base-branch into a pull request branch. If the PR contains all changes of it's base branch, false is returned for changed If it's not up-to-date and updating the PR was scheduled at github, true is returned for changed and scheduled. If the PR was updated while the method was executed, a goorderr.RetryableError is returned and the operation can be retried. If the branch can not be updated automatically because of a merge conflict, an error is returned.

type UpdateBranchResult added in v0.14.0

type UpdateBranchResult struct {
	Changed      bool
	Scheduled    bool
	HeadCommitID string
}

Jump to

Keyboard shortcuts

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