task

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyLabelChanges

func ApplyLabelChanges(requestCtx stdctx.Context, client *gitea.Client, owner, repo string, index int64, add, rm *gitea.IssueLabelsOption) error

ApplyLabelChanges adds and removes labels on an issue or pull request.

func ApplyReviewerChanges

func ApplyReviewerChanges(requestCtx stdctx.Context, client *gitea.Client, owner, repo string, index int64, add, rm []string) error

ApplyReviewerChanges adds and removes reviewers on a pull request.

func CreateAgitFlowPull

func CreateAgitFlowPull(requestCtx stdctx.Context, ctx *context.TeaContext, remote, head, base, topic string,
	opts *gitea.CreateIssueOption,
	callback func(string) (string, error),
) (err error)

CreateAgitFlowPull creates a agit flow PR in the given repo and prints the result

func CreateIssue

func CreateIssue(requestCtx stdctx.Context, rlogin *config.Login, repoOwner, repoName string, opts gitea.CreateIssueOption) error

CreateIssue creates an issue in the given repo and prints the result

func CreateLogin

func CreateLogin(ctx stdctx.Context, name, token, user, passwd, otp, scopes, sshKey, giteaURL, sshCertPrincipal, sshKeyFingerprint string, insecure, sshAgent, versionCheck, addHelper bool) error

CreateLogin create a login to be stored in config

func CreateMilestone

func CreateMilestone(ctx stdctx.Context, login *config.Login, repoOwner, repoName, title, description string, deadline *time.Time, state gitea.StateType) error

CreateMilestone creates a milestone in the given repo and prints the result

func CreatePull

func CreatePull(requestCtx stdctx.Context, ctx *context.TeaContext, base, head string, allowMaintainerEdits *bool, opts *gitea.CreateIssueOption) (err error)

CreatePull creates a PR in the given repo and prints the result

func CreatePullReview

func CreatePullReview(requestCtx stdctx.Context, ctx *context.TeaContext, idx int64, status gitea.ReviewStateType, comment string, codeComments []gitea.CreatePullReviewComment) error

CreatePullReview submits a review for a PR

func CreateWikiPage

func CreateWikiPage(ctx *teaContext.TeaContext, client WikiWriteClient, opt gitea.CreateWikiPageOptions) (*gitea.WikiPage, error)

CreateWikiPage creates a wiki page and returns the created page.

func DeleteWikiPage

func DeleteWikiPage(ctx *teaContext.TeaContext, client WikiWriteClient, pageName string) error

DeleteWikiPage deletes a wiki page.

func EditIssue

func EditIssue(requestCtx stdctx.Context, ctx *context.TeaContext, client *gitea.Client, opts EditIssueOption) (*gitea.Issue, error)

EditIssue edits an issue and returns the updated issue.

func EditPull

func EditPull(requestCtx stdctx.Context, ctx *context.TeaContext, client *gitea.Client, opts EditIssueOption) (*gitea.PullRequest, error)

EditPull edits a pull request and returns the updated pull request.

func EditWikiPage

func EditWikiPage(ctx *teaContext.TeaContext, client WikiWriteClient, pageName string, opt gitea.CreateWikiPageOptions) (*gitea.WikiPage, error)

EditWikiPage edits a wiki page and returns the updated page.

func GenerateLoginName

func GenerateLoginName(url, user string) (string, error)

GenerateLoginName generates a name string based on instance URL & adds username if the result is not unique

func GetDefaultPRBase

func GetDefaultPRBase(requestCtx stdctx.Context, login *config.Login, owner, repo string) (string, error)

GetDefaultPRBase retrieves the default base branch for the given repo

func GetDefaultPRHead

func GetDefaultPRHead(localRepo *local_git.TeaRepo) (owner, branch string, err error)

GetDefaultPRHead uses the currently checked out branch, tries to find a remote that has a branch with the same name, and extracts the owner from its URL. If no remote matches, owner is empty, meaning same as head repo owner.

func GetDefaultPRTitle

func GetDefaultPRTitle(header string) string

GetDefaultPRTitle transforms a string like a branchname to a readable text

func GetHeadSpec

func GetHeadSpec(owner, branch, baseOwner string) string

GetHeadSpec creates a head string as expected by gitea API

func LabelsExport

func LabelsExport(labels []*gitea.Label, path string) error

LabelsExport save list of labels to disc

func ListPullReviewComments

func ListPullReviewComments(requestCtx stdctx.Context, ctx *context.TeaContext, idx int64) ([]*gitea.PullReviewComment, error)

ListPullReviewComments lists all review comments across all reviews for a PR

func ListSSHPubkey

func ListSSHPubkey() []string

ListSSHPubkey lists all the ssh keys in the ssh agent and the ~/.ssh/*.pub files It returns a list of SSH keys in the format of: "fingerprint keytype comment - principals: principals (ssh-agent or path to pubkey file)"

func OpenFileInEditor

func OpenFileInEditor(filename string) error

OpenFileInEditor opens filename in a text editor, and blocks until the editor terminates.

func ParseDiffComments

func ParseDiffComments(diffFile string) ([]gitea.CreatePullReviewComment, error)

ParseDiffComments reads a diff, extracts comments from it & returns them in a gitea compatible struct

func PullCheckout

func PullCheckout(
	ctx stdctx.Context,
	login *config.Login,
	repoOwner, repoName string,
	forceCreateBranch bool,
	index int64,
	callback func(string) (string, error),
) error

PullCheckout checkout current workdir to the head branch of specified pull request

func PullClean

func PullClean(ctx stdctx.Context, login *config.Login, repoOwner, repoName string, index int64, ignoreSHA bool, callback func(string) (string, error)) error

PullClean deletes local & remote feature-branches for a closed pull

func PullMerge

func PullMerge(requestCtx stdctx.Context, login *config.Login, repoOwner, repoName string, index int64, opt gitea.MergePullRequestOption) error

PullMerge merges a PR

func RepoClone

func RepoClone(
	ctx stdctx.Context,
	path string,
	login *config.Login,
	repoOwner, repoName string,
	callback func(string) (string, error),
	depth int,
) (*local_git.TeaRepo, error)

RepoClone creates a local git clone in the given path, and sets up upstream remote for fork repos, for good usability with tea.

func ResolveLabelNames

func ResolveLabelNames(requestCtx stdctx.Context, client *gitea.Client, owner, repo string, labelNames []string) ([]int64, error)

ResolveLabelNames returns a list of label IDs for a given list of label names

func ResolveLabelOpts

func ResolveLabelOpts(requestCtx stdctx.Context, client *gitea.Client, owner, repo string, names []string) (*gitea.IssueLabelsOption, error)

ResolveLabelOpts resolves label names to IssueLabelsOption. Returns nil if names is empty.

func ResolveMilestoneID

func ResolveMilestoneID(requestCtx stdctx.Context, client *gitea.Client, owner, repo, name string) (int64, error)

ResolveMilestoneID resolves a milestone name to its ID. Returns 0 for empty name.

func ResolvePullReviewComment

func ResolvePullReviewComment(requestCtx stdctx.Context, ctx *context.TeaContext, commentID int64) error

ResolvePullReviewComment resolves a review comment

func SavePullDiff

func SavePullDiff(requestCtx stdctx.Context, ctx *context.TeaContext, idx int64) (string, error)

SavePullDiff fetches the diff of a pull request and stores it as a temporary file. The path to the file is returned.

func SetupHelper

func SetupHelper(login config.Login) (ok bool, err error)

SetupHelper add tea helper to config global

func UnresolvePullReviewComment

func UnresolvePullReviewComment(requestCtx stdctx.Context, ctx *context.TeaContext, commentID int64) error

UnresolvePullReviewComment unresolves a review comment

Types

type EditIssueOption

type EditIssueOption struct {
	Index           int64
	Title           *string
	Body            *string
	Ref             *string
	Milestone       *string
	Deadline        *time.Time
	AddLabels       []string
	RemoveLabels    []string
	AddAssignees    []string
	AddReviewers    []string
	RemoveReviewers []string
}

EditIssueOption wraps around gitea.EditIssueOption which has bad & incosistent semantics.

type WikiWriteClient

type WikiWriteClient interface {
	CreatePage(ctx stdctx.Context, owner, repo string, opt gitea.CreateWikiPageOptions) (*gitea.WikiPage, *gitea.Response, error)
	EditPage(ctx stdctx.Context, owner, repo, pageName string, opt gitea.CreateWikiPageOptions) (*gitea.WikiPage, *gitea.Response, error)
	DeletePage(ctx stdctx.Context, owner, repo, pageName string) (*gitea.Response, error)
}

WikiWriteClient defines the wiki write methods required by task helpers.

Jump to

Keyboard shortcuts

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