1
0
Fork 0
mirror of https://gitea.com/gitea/tea.git synced 2026-04-07 00:34:27 +02:00
tea/cmd
appleboy f329f6fab2 feat(pulls): add edit subcommand for pull requests (#944)
## Summary

- Add `tea pr edit` subcommand to support editing pull request properties (description, title, milestone, deadline, assignees, labels, reviewers)
- Add `--add-reviewers` / `--remove-reviewers` flags for managing PR reviewers via `CreateReviewRequests` / `DeleteReviewRequests` API
- Extract shared helpers (`ResolveLabelOpts`, `ApplyLabelChanges`, `ApplyReviewerChanges`, `ResolveMilestoneID`) into `modules/task/labels.go` to reduce duplication between issue and PR editing
- Refactor existing `EditIssue` to use the same shared helpers
- Wrap original error in `ResolveMilestoneID` to preserve underlying error context

## Usage

```bash
# Edit PR description
tea pr edit 1 --description "new description"

# Edit PR title
tea pr edit 1 --title "new title"

# Edit multiple fields
tea pr edit 1 --title "new title" --description "new desc" --add-labels "bug"

# Edit multiple PRs
tea pr edit 1 2 3 --add-assignees "user1"

# Add reviewers
tea pr edit 1 --add-reviewers "user1,user2"

# Remove reviewers
tea pr edit 1 --remove-reviewers "user1"
```

## Test plan

- [x] `go build .` succeeds
- [x] `go test ./...` passes
- [x] `make clean && make vet && make lint && make fmt-check && make docs-check && make build` all pass
- [x] `tea pr edit <idx> --description "test"` updates PR description on a Gitea instance
- [x] `tea pr edit <idx> --title "test"` updates PR title
- [x] `tea pr edit <idx> --add-labels "bug"` adds label
- [x] `tea pr edit <idx> --add-reviewers "user"` requests review
- [x] `tea pr edit <idx> --remove-reviewers "user"` removes reviewer
- [x] Existing `tea issues edit` still works correctly after refactor

Reviewed-on: https://gitea.com/gitea/tea/pulls/944
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: appleboy <appleboy.tw@gmail.com>
Co-committed-by: appleboy <appleboy.tw@gmail.com>
2026-04-05 05:35:15 +00:00
..
actions fix(deps): update module code.gitea.io/sdk/gitea to v0.24.1 (#936) 2026-03-27 06:04:29 +00:00
admin/users replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
attachments replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
branches replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
flags replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
issues replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
labels replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
login replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
milestones replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
notifications replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
organizations replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
pulls feat(pulls): add edit subcommand for pull requests (#944) 2026-04-05 05:35:15 +00:00
releases replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
repos replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
times replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
webhooks replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
actions.go Add tea actions runs and workflows commands (#880) 2026-02-11 00:40:06 +00:00
admin.go replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
api.go replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
api_test.go replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
attachments.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
branches.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
categories.go spdx (#581) 2023-09-08 01:40:02 +00:00
clone.go replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
cmd.go Move versions/filelocker into dedicated subpackages, and consistent headers in http requests (#888) 2026-02-05 18:05:43 +00:00
comment.go replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
detail_json.go replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
issues.go replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
issues_test.go replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
labels.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
login.go replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
logout.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
man.go generate man page (#811) 2025-09-14 00:17:28 +00:00
milestones.go replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
notifications.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
open.go replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
organizations.go replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
pulls.go feat(pulls): add edit subcommand for pull requests (#944) 2026-04-05 05:35:15 +00:00
releases.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
repos.go replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
times.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
webhooks.go replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00
whoami.go replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +00:00