Skip to content

ListPullRequestsWithCommit removed from API docs?  #2227

@mengmichael1

Description

@mengmichael1

👋 I am trying to use the ListPullRequestsWithCommit API. I noticed that information about it got removed from the API docs (it used to live in https://docs.github.com/en/rest/reference/repos#list-pull-requests-associated-with-a-commit). However, the API is still present within in the master go-github

go-github/github/pulls.go

Lines 168 to 194 in ff33a55

// ListPullRequestsWithCommit returns pull requests associated with a commit SHA.
//
// The results will include open and closed pull requests.
//
// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#list-pull-requests-associated-with-a-commit
func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, owner, repo, sha string, opts *PullRequestListOptions) ([]*PullRequest, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/commits/%v/pulls", owner, repo, sha)
u, err := addOptions(u, opts)
if err != nil {
return nil, nil, err
}
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeListPullsOrBranchesForCommitPreview)
var pulls []*PullRequest
resp, err := s.client.Do(ctx, req, &pulls)
if err != nil {
return nil, resp, err
}
return pulls, resp, nil
}

What's the situation? Is it about to get deprecated? Is there a better/cleaner way of determining the pull request associated with a commit SHA (given that I know the owner and repo)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions