actions

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const PRMetadataCommentEnd = "-->"
View Source
const PRMetadataCommentHelpText = "" /* 165-byte string literal not displayed */
View Source
const PRMetadataCommentStart = "<!-- av pr metadata"
View Source
const PRStackCommentEnd = "<!-- av pr stack end -->"
View Source
const PRStackCommentStart = "<!-- av pr stack begin -->"

Variables

This section is empty.

Functions

func AddPRMetadataAndStack added in v0.0.34

func AddPRMetadataAndStack(
	body string,
	prMeta PRMetadata,
	branchName string,
	stack *stackutils.StackTreeNode,
	tx meta.ReadTx,
) string

func AddPullRequestReviewers added in v0.0.28

func AddPullRequestReviewers(
	ctx context.Context,
	client *gh.Client,
	prID githubv4.ID,
	reviewers []string,
) error

AddPullRequestReviewers adds the given reviewers to the given pull request. It accepts a list of reviewers, which can be either GitHub user logins or team names in the format `@organization/team`.

func OpenPullRequestInBrowser added in v0.0.34

func OpenPullRequestInBrowser(pullRequestLink string)

func TidyDB added in v0.0.31

func TidyDB(repo *git.Repo, db meta.DB) (map[string]bool, map[string]bool, error)

TidyDB removes deleted branches from the metadata and returns number of branches removed from the DB.

func UpdatePullRequestWithStack added in v0.0.34

func UpdatePullRequestWithStack(
	ctx context.Context,
	client *gh.Client,
	tx meta.WriteTx,
	branchName string,
) error

UpdatePullRequestWithStack updates the GitHub pull request associated with the given branch to include the stack of branches that the branch is a part of. This should be called after all applicable PRs have been created to ensure we can properly link them.

func UpdatePullRequestsWithStack added in v0.0.34

func UpdatePullRequestsWithStack(
	ctx context.Context,
	client *gh.Client,
	tx meta.WriteTx,
	branchNames []string,
) error

UpdatePullRequestsWithStack updates the GitHub pull requests associated with the given branches to include the stack of branches that each branch is a part of.

Types

type CreatePullRequestOpts

type CreatePullRequestOpts struct {
	// The HEAD branch to create a pull request for.
	BranchName string
	// The pull request title.
	Title string
	// The pull request body (description).
	Body string
	// If true, create the pull request as a GitHub draft PR.
	Draft bool
	// If true, do not push the branch to GitHub
	NoPush bool
	// If true, force push the branch to GitHub
	ForcePush bool
	// If true, create a PR even if we think one already exists
	Force bool
	// If true, open an editor for editing the title and body
	Edit bool
	// If true, do not open the browser after creating the PR
	NoOpenBrowser bool
}

type CreatePullRequestResult added in v0.0.6

type CreatePullRequestResult struct {
	// True if the pull request was created
	Created bool
	// The (updated) branch metadata.
	Branch meta.Branch
	// The pull request object that was returned from GitHub
	Pull *gh.PullRequest
}

func CreatePullRequest

func CreatePullRequest(
	ctx context.Context,
	repo *git.Repo,
	client *gh.Client,
	tx meta.WriteTx,
	opts CreatePullRequestOpts,
) (_ *CreatePullRequestResult, reterr error)

CreatePullRequest creates a pull request on GitHub for the current branch, if one doesn't already exist.

type ErrExitSilently added in v0.0.16

type ErrExitSilently struct {
	ExitCode int
}

errExitSilently is an error type that indicates that program should exit without printing any additional information with the given exit code. This is meant for cases where the running commands wants to manage its own error output but still needs to return a non-zero exit code (since returning nil from RunE would cause a exit with a zero code).

func (ErrExitSilently) Error added in v0.0.16

func (e ErrExitSilently) Error() string

type PRMetadata added in v0.0.7

type PRMetadata struct {
	Parent     string `json:"parent"`
	ParentHead string `json:"parentHead"`
	ParentPull int64  `json:"parentPull,omitempty"`
	Trunk      string `json:"trunk"`
}

func ParsePRBody added in v0.0.34

func ParsePRBody(input string) (body string, prMeta PRMetadata, retErr error)

func ReadPRMetadata added in v0.0.7

func ReadPRMetadata(body string) (PRMetadata, error)

type UpdatePullRequestResult added in v0.0.4

type UpdatePullRequestResult struct {
	// True if the pull request information changed (e.g., a new pull request
	// was found or if the pull request changed state)
	Changed bool
	// The pull request object that was returned from GitHub
	Pull *gh.PullRequest
}

func UpdatePullRequestState added in v0.0.4

func UpdatePullRequestState(
	ctx context.Context,
	client *gh.Client,
	tx meta.WriteTx,
	branchName string,
) (*UpdatePullRequestResult, error)

UpdatePullRequestState fetches the latest pull request information from GitHub and writes the relevant branch metadata.

Jump to

Keyboard shortcuts

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