Documentation
¶
Index ¶
- Constants
- Variables
- func CommitMessage(message string) (commitMessage githubv4.CommitMessage)
- func CommittableBranch(repo Repo, branch string) githubv4.CommittableBranch
- func GetAutoMergeChoices() []string
- func ResolveToken(token string) (string, error)
- type Client
- func (c *Client) CreateCommitOnBranchV4(input githubv4.CreateCommitOnBranchInput) (oid githubv4.GitObjectID, url string, err error)
- func (c *Client) CreateDeploymentStatusV3(deploymentID, state, description, environment, environmentURL string) (int64, error)
- func (c *Client) CreateDeploymentV3(ref, environment, description string, transient, production bool) (*DeploymentInfo, error)
- func (c *Client) CreatePullRequestV4(pullRequest *PullRequest) (err error)
- func (c *Client) CreateRef(ref *github.Reference) (*github.Reference, error)
- func (c *Client) CreateRefV4(input githubv4.CreateRefInput) (err error)
- func (c *Client) CreateTag(name, message, sha string) (*github.Tag, error)
- func (c *Client) DeleteRef(ref string) error
- func (c *Client) FindPullRequestUrl(pullRequest *PullRequest) (found bool, err error)
- func (c *Client) GetCommitSHA(short string) (sha string, err error)
- func (c *Client) GetCommitURL(sha string) string
- func (c *Client) GetFileContentV4(branch string, path string) (content string, ok bool)
- func (c *Client) GetFileHashV4(branch string, path string) (hash string)
- func (c *Client) GetMatchingHeads(commitish string) (headNames []string, err error)
- func (c *Client) GetMatchingTags(sha string) (tagNames []string, err error)
- func (c *Client) GetRef(refName string) (*github.Reference, error)
- func (c *Client) GetRefOidV4(refName string) (oid githubv4.GitObjectID, err error)
- func (c *Client) GetRefSHA(refName, refType string) (sha string, err error)
- func (c *Client) GetRepositoryInfo(branch string) (repository repositoryInfo, err error)
- func (c *Client) GetSHA(commitish, defaultRefType string) (sha string, err error)
- func (c *Client) GetTagObj(name string) (tagObj *TagObj, err error)
- func (c *Client) ListDeploymentsV3(sha, environment string) ([]DeploymentInfo, error)
- func (c *Client) ResolveCommitish(commitish string) (sha string, err error)
- func (c *Client) UpdatePullRequestV4(pullRequest *PullRequest) error
- func (c *Client) UpdateRef(ref *github.Reference, force bool) (*github.Reference, error)
- func (c *Client) UpdateRefName(refName string, targetRef *github.Reference, force bool, immutable bool) (oldHash string, newHash string, err error)
- type DeploymentInfo
- type ErrImmutableRef
- type PullRequest
- type Repo
- type TagObj
Constants ¶
const ( AutoMergeOff = "off" AutoMergeMerge = "merge" AutoMergeSquash = "squash" AutoMergeRebase = "rebase" )
Auto-merge method constants
Variables ¶
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 ¶
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 (*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) CreateRefV4 ¶ added in v0.13.0
func (c *Client) CreateRefV4(input githubv4.CreateRefInput) (err 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
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 (*Client) GetFileContentV4 ¶ added in v0.13.0
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
GetFileHashV4 returns the hash of a file on the given branch
func (*Client) GetMatchingHeads ¶ added in v0.13.0
func (*Client) GetMatchingTags ¶ added in v0.13.0
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
GetRefSHA validates the existing of and returns the HEAD SHA of a ref
func (*Client) GetRepositoryInfo ¶ added in v0.13.0
GetRepositoryInfo returns information about a repository
func (*Client) GetTagObj ¶ added in v0.13.0
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
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
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
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"`
}