Documentation ¶
Index ¶
- func Bool(b bool) *bool
- func Int(i int) *int
- func String(s string) *string
- type Branch
- func (b *Branch) AddFiles(files []File) (newTreeSHA string, parentCommitSHA string, err error)
- func (b *Branch) CommitChanges(newTreeSHA, parentCommitSHA, commitMessage string) error
- func (b *Branch) Commits(perPage int) CommitIterator
- func (b *Branch) GetCommitsSinceCommit(hash *string) (map[string]*github.RepositoryCommit, error)
- func (b *Branch) GetDistinctCommits(base string) (commits map[string]*github.RepositoryCommit, err error)
- func (b *Branch) GetLastCommitMessage() (string, error)
- func (b *Branch) Reset(sha *string) error
- type BranchNotFound
- type Client
- func (c *Client) CreatePullRequest(head, base string, title string, body changelog.Markdown, draft bool) (*github.PullRequest, error)
- func (c *Client) EditPullRequest(head, base, title string, body changelog.Markdown) (*github.PullRequest, error)
- func (c *Client) GetPullRequest(head string, base string) (*github.PullRequest, error)
- func (c *Client) Repository() *Repository
- func (c *Client) SetPullRequest(head, base, title string, draft bool, ...) error
- type Commit
- type CommitAuthor
- type CommitIterator
- type CommitsComparison
- type File
- type GitService
- type MultiplePullRequestsFoundError
- type NoPrereleaseVersionFound
- type NoPullRequestFoundError
- type NoReleaseVersionFound
- type PullRequest
- type PullRequestBranch
- type PullRequestsService
- type RepositoriesService
- type Repository
- func (r *Repository) Branch(name string) (b *Branch, err error)
- func (r *Repository) CreateBranch(name string, sha *string) (branch *Branch, err error)
- func (r *Repository) DefaultBranch() (branch *Branch, err error)
- func (r *Repository) LatestPrereleaseVersion(prereleaseIdentifier string) (*Version, error)
- func (r *Repository) LatestVersion() (*Version, error)
- func (r *Repository) PreviousVersion() (*Version, error)
- func (r *Repository) Tags() (tags []*github.RepositoryTag, err error)
- func (r *Repository) Versions() (*RepositoryVersions, error)
- type RepositoryCommit
- type RepositoryMetadata
- type RepositoryTag
- type RepositoryVersions
- type Timestamp
- type Tree
- type Version
- type Versions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Branch ¶
type Branch struct { RepositoriesService RepositoryMetadata RepositoryMetadata GitService *github.Branch Ctx context.Context Name string }
Branch is a struct that contains the RepositoriesService, context, token, owner, name, and branch. It is used to interact with the GitHub API in the context of a specific repository.
func (*Branch) AddFiles ¶
AddFiles adds multiple files to a branch and returns the new tree SHA and parent commit SHA
func (*Branch) CommitChanges ¶
func (*Branch) Commits ¶
func (b *Branch) Commits(perPage int) CommitIterator
func (*Branch) GetCommitsSinceCommit ¶
GetCommitsSinceCommit returns a map of commits from the hash commit to the latest commit, if hash is nil, it will return all commits on the current branch
func (*Branch) GetDistinctCommits ¶
func (b *Branch) GetDistinctCommits(base string) (commits map[string]*github.RepositoryCommit, err error)
GetDistinctCommits returns a map of unique commits from the base branch to the head branch
Parameters:
- base: The base branch to compare against
Returns:
- map[string]*github.RepositoryCommit: A map of unique commits between the base and current branch
- error: An error if one occurred
func (*Branch) GetLastCommitMessage ¶
GetLastCommitMessage retrieves the last commit message from the branch
type BranchNotFound ¶
type BranchNotFound struct {
Name string
}
func (BranchNotFound) Error ¶
func (e BranchNotFound) Error() string
type Client ¶
type Client struct { Ctx context.Context PullRequests PullRequestsService Repositories RepositoriesService Git GitService RepositoryMetadata }
Client is a struct that contains the go-github client and the repository metadata to interact with the GitHub API.
func (*Client) CreatePullRequest ¶
func (*Client) EditPullRequest ¶
func (*Client) GetPullRequest ¶
func (*Client) Repository ¶
func (c *Client) Repository() *Repository
type CommitAuthor ¶
type CommitAuthor = github.CommitAuthor
type CommitIterator ¶
type CommitIterator struct { *Branch // contains filtered or unexported fields }
CommitIterator iterates over commits in a branch.
func (*CommitIterator) Commits ¶
func (b *CommitIterator) Commits() []*github.RepositoryCommit
Commits returns the current batch of commits.
func (*CommitIterator) Err ¶
func (b *CommitIterator) Err() error
Err returns the last error encountered by the iterator.
func (*CommitIterator) Next ¶
func (b *CommitIterator) Next() bool
Next loads the next batch of commits if needed and advances the iterator.
type CommitsComparison ¶
type CommitsComparison = github.CommitsComparison
type GitService ¶
type GitService interface { CreateRef(ctx context.Context, owner string, repo string, ref *github.Reference) (*github.Reference, *github.Response, error) UpdateRef(ctx context.Context, owner string, repo string, ref *github.Reference, force bool) (*github.Reference, *github.Response, error) CreateBlob(ctx context.Context, owner string, repo string, blob *github.Blob) (*github.Blob, *github.Response, error) CreateTree(ctx context.Context, owner string, repo string, baseTree string, entries []*github.TreeEntry) (*github.Tree, *github.Response, error) CreateCommit(ctx context.Context, owner string, repo string, commit *Commit, opts *github.CreateCommitOptions) (*Commit, *github.Response, error) }
type MultiplePullRequestsFoundError ¶
func (MultiplePullRequestsFoundError) Error ¶
func (e MultiplePullRequestsFoundError) Error() string
type NoPrereleaseVersionFound ¶
type NoPrereleaseVersionFound struct{}
func (NoPrereleaseVersionFound) Error ¶
func (e NoPrereleaseVersionFound) Error() string
type NoPullRequestFoundError ¶
func (NoPullRequestFoundError) Error ¶
func (e NoPullRequestFoundError) Error() string
type NoReleaseVersionFound ¶
type NoReleaseVersionFound struct{}
func (NoReleaseVersionFound) Error ¶
func (e NoReleaseVersionFound) Error() string
type PullRequest ¶
type PullRequest = github.PullRequest
type PullRequestBranch ¶
type PullRequestBranch = github.PullRequestBranch
type PullRequestsService ¶
type PullRequestsService interface { Create(ctx context.Context, owner string, repo string, newPR *github.NewPullRequest) (*github.PullRequest, *github.Response, error) List(ctx context.Context, owner string, repo string, opts *github.PullRequestListOptions) ([]*github.PullRequest, *github.Response, error) Edit(ctx context.Context, owner string, repo string, number int, pull *github.PullRequest) (*github.PullRequest, *github.Response, error) }
PullRequestsService is an interface abstracting operations supported by go-github's github.PullRequestsService
type RepositoriesService ¶
type RepositoriesService interface { CompareCommits(ctx context.Context, owner string, repo string, base string, head string, opts *github.ListOptions) (*github.CommitsComparison, *github.Response, error) ListCommits(ctx context.Context, owner string, repo string, opt *github.CommitsListOptions) ([]*github.RepositoryCommit, *github.Response, error) ListTags(ctx context.Context, owner string, repo string, opt *github.ListOptions) ([]*github.RepositoryTag, *github.Response, error) GetBranch(ctx context.Context, owner string, repo string, branch string, maxRedirects int) (*github.Branch, *github.Response, error) Get(ctx context.Context, owner string, repo string) (*github.Repository, *github.Response, error) }
RepositoriesService is an interface abstracting operations supported by go-github's github.RepositoriesService
type Repository ¶
type Repository struct { GitService RepositoriesService RepositoryMetadata RepositoryMetadata Ctx context.Context // contains filtered or unexported fields }
Repository is a struct that contains the RepositoriesService, context, token, owner, and name. It is used to interact with the GitHub API in the context of a specific repository.
func (*Repository) Branch ¶
func (r *Repository) Branch(name string) (b *Branch, err error)
Branch returns a Branch struct that contains the GitHub client, context, token, owner, name, and branch. After validating that the branch exists, it will return a Branch struct that can be used to interact with the GitHub API.
func (*Repository) CreateBranch ¶
func (r *Repository) CreateBranch(name string, sha *string) (branch *Branch, err error)
CreateBranch creates a branch with the given name and SHA. If the SHA is nil, the default branch's SHA will be used.
func (*Repository) DefaultBranch ¶
func (r *Repository) DefaultBranch() (branch *Branch, err error)
func (*Repository) LatestPrereleaseVersion ¶
func (r *Repository) LatestPrereleaseVersion(prereleaseIdentifier string) (*Version, error)
LatestPrereleaseVersion returns the Version with the highest prerelease tag in the repository with the given prerelease identifier. If there are no prerelease tags, an error is returned. The tags and latest version are cached in the repository struct, so subsequent calls to LatestPrereleaseVersion will not make additional network requests.
func (*Repository) LatestVersion ¶
func (r *Repository) LatestVersion() (*Version, error)
LatestVersion returns the Version with the highest release tag in the repository. If there are no release tags, an error is returned. The tags and latest version are cached in the repository struct, so subsequent calls to LatestVersion will not make additional network requests. Invalid semantic version tags are ignored.
func (*Repository) PreviousVersion ¶
func (r *Repository) PreviousVersion() (*Version, error)
PreviousVersion returns the Version immediately preceding the Version with the highest release tag in the repository. If there are no release tags, an error is returned. The tags and latest version are cached in the repository struct,
so subsequent calls to PreviousVersion will not make additional network requests. Invalid semantic version tags are ignored.
func (*Repository) Tags ¶
func (r *Repository) Tags() (tags []*github.RepositoryTag, err error)
Tags returns the list of tags in the repository. The tags are cached in the repository struct, so subsequent calls to Tags will not make additional network requests.
func (*Repository) Versions ¶
func (r *Repository) Versions() (*RepositoryVersions, error)
Versions returns the stable and prerelease versions for the repository. The tags and versions are cached in the repository struct, so subsequent calls to Versions will not make additional network requests. Tags that are not valid semantic versions are ignored.
type RepositoryCommit ¶
type RepositoryCommit = github.RepositoryCommit
type RepositoryMetadata ¶
type RepositoryTag ¶
type RepositoryTag = github.RepositoryTag
type RepositoryVersions ¶
type RepositoryVersions struct {
// contains filtered or unexported fields
}
RepositoryVersions contains the stable and prerelease versions for a repository