git

package
v0.0.0-...-31558c7 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommitsSinceHash

func CommitsSinceHash(gitDir, hash string, inclusive bool) ([]string, error)

CommitsSinceHash gathers all of the commits since the provided hash for the given gitDir. The inclusive parameter tells if the provided hash should also be returned in the slice.

func DeepClone

func DeepClone(repo, dir string) error

DeepClone clones a repository in the given directory.

func FormatChanges

func FormatChanges(changes []*ChangeInfo, onlyGapicChanges bool) string

FormatChanges turns a slice of changes into formatted string that will match the conventional commit footer pattern. This will allow these changes to be parsed into the changelog.

func HasChanges

func HasChanges(dir string) (bool, error)

HasChanges reports whether the given directory has uncommitted git changes.

func UpdateFilesSinceHash

func UpdateFilesSinceHash(gitDir, hash string) ([]string, error)

UpdateFilesSinceHash returns a listed of files updated since the provided hash for the given gitDir.

Types

type ChangeInfo

type ChangeInfo struct {
	Body           string
	Title          string
	GoogleapisHash string
}

ChangeInfo represents a change and its associated metadata.

func ParseChangeInfo

func ParseChangeInfo(googleapisDir string, hashes []string) ([]*ChangeInfo, error)

ParseChangeInfo gets the ChangeInfo for a given googleapis hash.

type GithubClient

type GithubClient struct {

	// Username is the GitHub username. Read-only.
	Username string
	// contains filtered or unexported fields
}

GithubClient is a convenience wrapper around Github clients.

func NewGithubClient

func NewGithubClient(ctx context.Context, username, name, email, accessToken string) (*GithubClient, error)

NewGithubClient creates a new GithubClient.

func (*GithubClient) CreateGenprotoPR

func (gc *GithubClient) CreateGenprotoPR(ctx context.Context, genprotoDir string, hasCorrespondingPR bool, changes []*ChangeInfo) (prNumber int, _ error)

CreateGenprotoPR creates a PR for a given genproto change.

hasCorrespondingPR indicates that there is a corresponding google-cloud-go PR.

func (*GithubClient) GetPRWithTitle

func (gc *GithubClient) GetPRWithTitle(ctx context.Context, repo, status, title string) (*PullRequest, error)

GetPRWithTitle finds the first pull request with the given status and title. Accepted statues are: open, closed, or all.

func (*GithubClient) GetRegenPR

func (gc *GithubClient) GetRegenPR(ctx context.Context, repo, status string) (*PullRequest, error)

GetRegenPR finds the first regen pull request with the given status. Accepted statues are: open, closed, or all.

type PullRequest

type PullRequest struct {
	Author  string
	Title   string
	URL     string
	Created time.Time
	IsOpen  bool
	Number  int
	Repo    string
	IsDraft bool
	NodeID  string
}

PullRequest represents a GitHub pull request.

Jump to

Keyboard shortcuts

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