remote

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AutoMergeOff    = "off"
	AutoMergeMerge  = "merge"
	AutoMergeSquash = "squash"
	AutoMergeRebase = "rebase"
)

Auto-merge method constants

Variables

View Source
var (
	ErrNoMatchingObject = errors.New("no matching object found")
)

Functions

func CommitMessage

func CommitMessage(message string) (commitMessage githubv4.CommitMessage)

func CommittableBranch

func CommittableBranch(repo Repo, branch string) githubv4.CommittableBranch

func GetAutoMergeChoices added in v0.14.2

func GetAutoMergeChoices() []string

GetAutoMergeChoices returns the available auto-merge choices

func ResolveToken

func ResolveToken(token string) (string, error)

ResolveToken tries to find a GitHub token in the following order: 1. If the token is a file path, read the file and return the contents 2. If the token is non-empty, return the token as is 3. If the token is empty, return an error

Types

type Client added in v0.13.0

type Client struct {
	V3 *github.Client
	V4 *githubv4.Client
	// contains filtered or unexported fields
}

func NewClient added in v0.13.0

func NewClient(ctx context.Context, repo *Repo) (*Client, error)

func (*Client) CreateCommitOnBranchV4 added in v0.13.0

func (c *Client) CreateCommitOnBranchV4(input githubv4.CreateCommitOnBranchInput) (oid githubv4.GitObjectID, url string, err error)

func (*Client) CreateDeploymentStatusV3 added in v0.18.0

func (c *Client) CreateDeploymentStatusV3(deploymentID, state, description, environment, environmentURL string) (int64, error)

CreateDeploymentStatusV3 creates a deployment status using REST API (hybrid approach)

func (*Client) CreateDeploymentV3 added in v0.18.0

func (c *Client) CreateDeploymentV3(ref, environment, description string, transient, production bool) (*DeploymentInfo, error)

CreateDeploymentV3 creates a deployment using REST API (hybrid approach)

func (*Client) CreatePullRequestV4 added in v0.13.0

func (c *Client) CreatePullRequestV4(pullRequest *PullRequest) (err error)

func (*Client) CreateRef added in v0.13.0

func (c *Client) CreateRef(ref *github.Reference) (*github.Reference, error)

func (*Client) CreateRefV4 added in v0.13.0

func (c *Client) CreateRefV4(input githubv4.CreateRefInput) (err error)

func (*Client) CreateTag added in v0.13.0

func (c *Client) CreateTag(name, message, sha string) (*github.Tag, error)

func (*Client) DeleteRef added in v0.13.0

func (c *Client) DeleteRef(ref string) error

func (*Client) FindPullRequestUrl added in v0.13.0

func (c *Client) FindPullRequestUrl(pullRequest *PullRequest) (found bool, err error)

func (*Client) GetCommitSHA added in v0.13.0

func (c *Client) GetCommitSHA(short string) (sha string, err error)

GetCommitSHA validates the existence of and retrieves the full SHA of a commit given a short SHA

func (*Client) GetCommitURL added in v0.13.0

func (c *Client) GetCommitURL(sha string) string

func (*Client) GetFileContentV4 added in v0.13.0

func (c *Client) GetFileContentV4(branch string, path string) (content string, ok bool)

GetFileContentV4 returns the content and hash of a file on the given branch. It is limited to non-binary files, as the content is returned as a string. If there is any error (including binary file)

func (*Client) GetFileHashV4 added in v0.13.0

func (c *Client) GetFileHashV4(branch string, path string) (hash string)

GetFileHashV4 returns the hash of a file on the given branch

func (*Client) GetMatchingHeads added in v0.13.0

func (c *Client) GetMatchingHeads(commitish string) (headNames []string, err error)

func (*Client) GetMatchingTags added in v0.13.0

func (c *Client) GetMatchingTags(sha string) (tagNames []string, err error)

func (*Client) GetRef added in v0.13.0

func (c *Client) GetRef(refName string) (*github.Reference, error)

func (*Client) GetRefOidV4 added in v0.13.0

func (c *Client) GetRefOidV4(refName string) (oid githubv4.GitObjectID, err error)

func (*Client) GetRefSHA added in v0.13.0

func (c *Client) GetRefSHA(refName, refType string) (sha string, err error)

GetRefSHA validates the existing of and returns the HEAD SHA of a ref

func (*Client) GetRepositoryInfo added in v0.13.0

func (c *Client) GetRepositoryInfo(branch string) (repository repositoryInfo, err error)

GetRepositoryInfo returns information about a repository

func (*Client) GetSHA added in v0.13.0

func (c *Client) GetSHA(commitish, defaultRefType string) (sha string, err error)

GetSHA returns the full SHA of a commitish

func (*Client) GetTagObj added in v0.13.0

func (c *Client) GetTagObj(name string) (tagObj *TagObj, err error)

GetTag resolves a tag reference, returning a pseudo-reference

func (*Client) ListDeploymentsV3 added in v0.18.0

func (c *Client) ListDeploymentsV3(sha, environment string) ([]DeploymentInfo, error)

ListDeploymentsV3 lists deployments for a repository using REST API

func (*Client) ResolveCommitish added in v0.13.0

func (c *Client) ResolveCommitish(commitish string) (sha string, err error)

ResolveCommitish resolves a commitish to a full SHA using the GitHub GraphQL API

func (*Client) UpdatePullRequestV4 added in v0.17.0

func (c *Client) UpdatePullRequestV4(pullRequest *PullRequest) error

func (*Client) UpdateRef added in v0.13.0

func (c *Client) UpdateRef(ref *github.Reference, force bool) (*github.Reference, error)

func (*Client) UpdateRefName added in v0.13.0

func (c *Client) UpdateRefName(refName string, targetRef *github.Reference, force bool, immutable bool) (oldHash string, newHash string, err error)

type DeploymentInfo added in v0.18.0

type DeploymentInfo struct {
	ID          string
	Environment string
	State       string
	SHA         string
	Ref         string
	Description string
	CreatedAt   string
	URL         string
}

DeploymentInfo represents deployment information from GraphQL queries

type ErrImmutableRef added in v0.17.0

type ErrImmutableRef struct {
	RefName      string
	ExistingHash string
	ProposedHash string
}

ErrImmutableRef is returned when an update is skipped because the ref is immutable and has diverged

func (*ErrImmutableRef) Error added in v0.17.0

func (e *ErrImmutableRef) Error() string

type PullRequest added in v0.13.0

type PullRequest struct {
	RepoId        string `json:"-" yaml:"-"`
	Id            string `json:"-" yaml:"-"`
	Number        int    `json:"number,omitzero" yaml:"number,omitempty"`
	Url           string `json:"url" yaml:"url"`
	Head          string `json:"head" yaml:"head"`
	Base          string `json:"base" yaml:"base"`
	Draft         bool   `json:"draft" yaml:"draft"`
	Title         string `json:"title" yaml:"title"`
	Body          string `json:"-" yaml:"-"`
	AutoMergeMode string `json:"auto_merge_mode,omitempty" yaml:"auto_merge_mode,omitempty"`
}

type Repo added in v0.13.0

type Repo struct {
	Owner string `json:"owner"`
	Name  string `json:"repo"`
}

func (*Repo) String added in v0.13.0

func (r *Repo) String() string

type TagObj added in v0.13.0

type TagObj struct {
	Name   string
	Commit struct {
		SHA string
		URL string
	}
	Lightweight bool
	Object      struct {
		SHA     string
		Message string
	}
}

Jump to

Keyboard shortcuts

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