gitea.tea/modules/task
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
..
issue_create.go Use bubbletea instead of survey for interacting with TUI (#786) 2025-08-11 18:23:52 +00:00
issue_edit.go feat(pulls): add edit subcommand for pull requests (#944) 2026-04-05 05:35:15 +00:00
labels.go feat(pulls): add edit subcommand for pull requests (#944) 2026-04-05 05:35:15 +00:00
labels_export.go spdx (#581) 2023-09-08 01:40:02 +00:00
login_create.go replace log.Fatal/os.Exit with error returns (#941) 2026-03-27 03:36:44 +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 spdx (#581) 2023-09-08 01:40:02 +00:00
login_ssh.go spdx (#581) 2023-09-08 01:40:02 +00:00
milestone_create.go Code Cleanup (#869) 2026-02-02 22:39:26 +00:00
pull_checkout.go feat: store OAuth tokens in OS keyring via credstore (#926) 2026-03-12 02:49:14 +00:00
pull_clean.go feat: store OAuth tokens in OS keyring via credstore (#926) 2026-03-12 02:49:14 +00:00
pull_create.go feat: store OAuth tokens in OS keyring via credstore (#926) 2026-03-12 02:49:14 +00:00
pull_create_test.go spdx (#581) 2023-09-08 01:40:02 +00:00
pull_edit.go feat(pulls): add edit subcommand for pull requests (#944) 2026-04-05 05:35:15 +00:00
pull_merge.go Support auto detecting branch for PRs (#525) 2024-07-26 19:21:48 +00:00
pull_review.go spdx (#581) 2023-09-08 01:40:02 +00:00
repo_clone.go feat: store OAuth tokens in OS keyring via credstore (#926) 2026-03-12 02:49:14 +00:00