actions

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var ErrNoPRMetadata = errors.Sentinel("no PR metadata found")

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 NewAdoptBranchesModel added in v0.1.14

func NewAdoptBranchesModel(
	db meta.DB,
	branches []AdoptingBranch,
	onDone func() tea.Cmd,
) tea.Model

func NewAdoptTreeSelectorModel added in v0.1.14

func NewAdoptTreeSelectorModel(
	infos map[plumbing.ReferenceName]BranchTreeInfo,
	rootNodes []*stackutils.StackTreeNode,
	adoptionTargets []plumbing.ReferenceName,
	currentHEADBranch plumbing.ReferenceName,
	onDone func(chosenTargets []plumbing.ReferenceName) tea.Cmd,
) tea.Model

func NewFindAdoptableLocalBranchesModel added in v0.1.14

func NewFindAdoptableLocalBranchesModel(
	repo *git.Repo,
	db meta.DB,
	onDone func(
		branches map[plumbing.ReferenceName]*treedetector.BranchPiece,
		rootNodes []*stackutils.StackTreeNode,
		adoptionTargets []plumbing.ReferenceName,
	) tea.Cmd,
) tea.Model

func NewGetRemoteStackedPRModel added in v0.1.14

func NewGetRemoteStackedPRModel(
	repo meta.Repository,
	ghClient *gh.Client,
	initialBranchName string,
	onDone func([]RemotePRInfo) tea.Cmd,
) tea.Model

func NewGitFetchModel added in v0.1.14

func NewGitFetchModel(
	repo *git.Repo,
	refspecs []string,
	onDone func() tea.Cmd,
) tea.Model

func OpenPullRequestInBrowser added in v0.0.34

func OpenPullRequestInBrowser(ctx context.Context, pullRequestLink string)

func TidyDB added in v0.0.31

func TidyDB(
	ctx context.Context,
	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 AdoptBranchesModel added in v0.1.14

type AdoptBranchesModel struct {
	// contains filtered or unexported fields
}

func (*AdoptBranchesModel) Init added in v0.1.14

func (m *AdoptBranchesModel) Init() tea.Cmd

func (*AdoptBranchesModel) Update added in v0.1.14

func (m *AdoptBranchesModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*AdoptBranchesModel) View added in v0.1.14

func (m *AdoptBranchesModel) View() string

type AdoptTreeSelectorModel added in v0.1.14

type AdoptTreeSelectorModel struct {
	// contains filtered or unexported fields
}

func (*AdoptTreeSelectorModel) Init added in v0.1.14

func (m *AdoptTreeSelectorModel) Init() tea.Cmd

func (*AdoptTreeSelectorModel) Update added in v0.1.14

func (m *AdoptTreeSelectorModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*AdoptTreeSelectorModel) View added in v0.1.14

func (m *AdoptTreeSelectorModel) View() string

type AdoptingBranch added in v0.1.14

type AdoptingBranch struct {
	Name        string
	Parent      meta.BranchState
	PullRequest *meta.PullRequest
}

type BranchTreeInfo added in v0.1.14

type BranchTreeInfo struct {
	TitleLine string
	Body      string
}

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 FindAdoptableLocalBranchesModel added in v0.1.14

type FindAdoptableLocalBranchesModel struct {
	// contains filtered or unexported fields
}

func (*FindAdoptableLocalBranchesModel) Init added in v0.1.14

func (*FindAdoptableLocalBranchesModel) Update added in v0.1.14

func (*FindAdoptableLocalBranchesModel) View added in v0.1.14

type GetRemoteStackedPRModel added in v0.1.14

type GetRemoteStackedPRModel struct {
	// contains filtered or unexported fields
}

func (*GetRemoteStackedPRModel) Init added in v0.1.14

func (m *GetRemoteStackedPRModel) Init() tea.Cmd

func (*GetRemoteStackedPRModel) Update added in v0.1.14

func (m *GetRemoteStackedPRModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*GetRemoteStackedPRModel) View added in v0.1.14

func (m *GetRemoteStackedPRModel) View() string

type GitFetchModel added in v0.1.14

type GitFetchModel struct {
	// contains filtered or unexported fields
}

func (*GitFetchModel) Init added in v0.1.14

func (m *GitFetchModel) Init() tea.Cmd

func (*GitFetchModel) Update added in v0.1.14

func (m *GitFetchModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*GitFetchModel) View added in v0.1.14

func (m *GitFetchModel) View() 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 RemotePRInfo added in v0.1.14

type RemotePRInfo struct {
	Name        string
	Parent      meta.BranchState
	PullRequest meta.PullRequest
	MergeCommit string
	Title       string
}

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