Add agentpr pr edit subcommand
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful

Update a PR's title and/or body as the agent user, sending only the
fields supplied.
This commit is contained in:
2026-09-19 12:32:07 +10:00
parent cdced6536e
commit 7bc4082cb0
6 changed files with 171 additions and 8 deletions
+16
View File
@@ -214,6 +214,22 @@ func (c *GiteaClient) CreatePR(repoPath string, opts CreatePROptions) (PullReque
return pr, err
}
// EditPROptions are the fields an edit may change. Pointers so an unset field
// is omitted from the payload entirely: Gitea overwrites whatever it is sent,
// so a nil Title leaves the title alone while a pointer to "" clears it.
type EditPROptions struct {
Title *string `json:"title,omitempty"`
Body *string `json:"body,omitempty"`
}
// EditPR updates a pull request's title and/or body
// (PATCH /api/v1/repos/{owner}/{repo}/pulls/{index}).
func (c *GiteaClient) EditPR(repoPath string, number int, opts EditPROptions) (PullRequest, error) {
var pr PullRequest
err := c.do(http.MethodPatch, fmt.Sprintf("/api/v1/repos/%s/pulls/%d", repoPath, number), opts, &pr)
return pr, err
}
// GetPR fetches a single pull request.
func (c *GiteaClient) GetPR(repoPath string, number int) (PullRequest, error) {
var pr PullRequest