gitea.tea/modules/task
Jan Baer 5aedf30e7b feat(pulls): offer to delete the source branch after merging
Implements #1050.

Prompt to delete the source branch after a successful tea pr merge,
displaying the branch name because deletion cannot be undone.
--delete-branch skips the prompt for scripts; this flag was requested
in #810 for gh parity before being closed as an upstream Gitea bug.

PullDeleteBranch takes a confirmation callback rather than prompting
directly, fetching the pull request once and passing the branch name
to the caller. The callback runs after state and permission checks so
the user is not prompted for a deletion that would fail anyway.

Deletion uses the API against the head repository, so it works for
pull requests opened from a fork never checked out locally.
tea pr clean is unsuitable because it requires a local repo and fails
when the branch is not found locally. A matching local branch is still
removed as a best effort, matched by commit rather than name so a branch
with unpushed commits is left alone; PullClean makes the same choice
and only accepts name matching behind --ignore-sha.

The prompt is gated on stdin and stdout both being terminals, following
the existing check in modules/context. TeaContext.IsInteractiveMode
could not be used: despite its doc comment, it only reports whether any
flag was passed, so a script running a bare tea pr merge <idx> would
have blocked on a prompt it could not answer.

Branches already deleted server-side, PRs still open, and head
repositories the user cannot push to are each handled explicitly rather
than surfacing a raw API error.

Signed-off-by: Jan Baer <jan.s.baer@googlemail.com>
2026-09-01 09:00:22 +02:00
..
assignees.go feat(assignees): add set, add, and remove assignees APIs (#1045) 2026-07-18 00:20:03 +00:00
issue_create.go Move sdk from code.gitea.io/sdk/gitea to gitea.dev/sdk (#1006) 2026-05-26 04:51:09 +00:00
issue_edit.go feat(assignees): add set, add, and remove assignees APIs (#1045) 2026-07-18 00:20:03 +00:00
labels.go fix(labels): add org label for ls and pr (#1017) 2026-06-24 17:46:12 +00:00
labels_export.go Move sdk from code.gitea.io/sdk/gitea to gitea.dev/sdk (#1006) 2026-05-26 04:51:09 +00:00
login_create.go feat(login): add status command (#1087) (#1105) 2026-08-28 23:55:13 +00:00
login_create_test.go Skip token uniqueness check when using SSH authentication (#898) 2026-02-19 15:19:45 +00:00
login_httpsign.go Move sdk from code.gitea.io/sdk/gitea to gitea.dev/sdk (#1006) 2026-05-26 04:51:09 +00:00
login_ssh.go Move sdk from code.gitea.io/sdk/gitea to gitea.dev/sdk (#1006) 2026-05-26 04:51:09 +00:00
login_status.go feat(login): add status command (#1087) (#1105) 2026-08-28 23:55:13 +00:00
login_status_test.go feat(login): add status command (#1087) (#1105) 2026-08-28 23:55:13 +00:00
milestone_create.go Move sdk from code.gitea.io/sdk/gitea to gitea.dev/sdk (#1006) 2026-05-26 04:51:09 +00:00
pull_checkout.go Add reply to code review (#978) 2026-06-26 21:40:31 +00:00
pull_clean.go Move sdk from code.gitea.io/sdk/gitea to gitea.dev/sdk (#1006) 2026-05-26 04:51:09 +00:00
pull_create.go feat(pulls): show PR URL in detail view (#1036) 2026-06-15 20:35:21 +00:00
pull_create_test.go spdx (#581) 2023-09-08 01:40:02 +00:00
pull_delete_branch.go feat(pulls): offer to delete the source branch after merging 2026-09-01 09:00:22 +02:00
pull_delete_branch_test.go feat(pulls): offer to delete the source branch after merging 2026-09-01 09:00:22 +02:00
pull_edit.go feat(assignees): add set, add, and remove assignees APIs (#1045) 2026-07-18 00:20:03 +00:00
pull_merge.go Move sdk from code.gitea.io/sdk/gitea to gitea.dev/sdk (#1006) 2026-05-26 04:51:09 +00:00
pull_review.go Move sdk from code.gitea.io/sdk/gitea to gitea.dev/sdk (#1006) 2026-05-26 04:51:09 +00:00
pull_review_comment.go Add reply to code review (#978) 2026-06-26 21:40:31 +00:00
repo_clone.go Move sdk from code.gitea.io/sdk/gitea to gitea.dev/sdk (#1006) 2026-05-26 04:51:09 +00:00
wiki.go feat: add wiki CLI commands (#998) 2026-05-26 21:14:47 +00:00
wiki_test.go feat: add wiki CLI commands (#998) 2026-05-26 21:14:47 +00:00