Edit a pull request. pull must not be nil. The following fields are editable: Title, Body, State, Base.Ref and MaintainerCanModify. Base.Ref updates the base branch of the pull request. GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#update-a-pull-request meta:oper
(ctx context.Context, owner, repo string, number int, pull *PullRequest)
| 360 | // |
| 361 | //meta:operation PATCH /repos/{owner}/{repo}/pulls/{pull_number} |
| 362 | func (s *PullRequestsService) Edit(ctx context.Context, owner, repo string, number int, pull *PullRequest) (*PullRequest, *Response, error) { |
| 363 | if pull == nil { |
| 364 | return nil, nil, errors.New("pull must be provided") |
| 365 | } |
| 366 | |
| 367 | u := fmt.Sprintf("repos/%v/%v/pulls/%v", owner, repo, number) |
| 368 | |
| 369 | update := &pullRequestUpdate{ |
| 370 | Title: pull.Title, |
| 371 | Body: pull.Body, |
| 372 | State: pull.State, |
| 373 | MaintainerCanModify: pull.MaintainerCanModify, |
| 374 | } |
| 375 | // avoid updating the base branch when closing the Pull Request |
| 376 | // - otherwise the GitHub API server returns a "Validation Failed" error: |
| 377 | // "Cannot change base branch of closed pull request". |
| 378 | if pull.Base != nil && pull.GetState() != "closed" { |
| 379 | update.Base = pull.Base.Ref |
| 380 | } |
| 381 | |
| 382 | req, err := s.client.NewRequest(ctx, "PATCH", u, update) |
| 383 | if err != nil { |
| 384 | return nil, nil, err |
| 385 | } |
| 386 | |
| 387 | var p *PullRequest |
| 388 | resp, err := s.client.Do(req, &p) |
| 389 | if err != nil { |
| 390 | return nil, resp, err |
| 391 | } |
| 392 | |
| 393 | return p, resp, nil |
| 394 | } |
| 395 | |
| 396 | // ListCommits lists the commits in a pull request. |
| 397 | // |
nothing calls this directly
no test coverage detected