Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHPullRequest calling non-existent API endpoint. (expected /pulls but is /issues) #1794

Closed
daniel-b2c2 opened this issue Feb 20, 2024 · 1 comment

Comments

@daniel-b2c2
Copy link

daniel-b2c2 commented Feb 20, 2024

Describe the bug

GHPullRequest pr ....
PagedIterable<GHPullRequestReview> reviews = pr.listReviews();

The call to retrieve the set of pull requests is being sent to the wrong API endpoint.

The correct endpoint is
https://api.github.com/repos/company/project/pulls/10312/reviews
but currently, the endpoint being called is https://api.github.com/repos/company/project/issues/10312/reviews

To Reproduce
Steps to reproduce the behavior:

List<String> targetLabels = ....
GHRepository repository = github.getRepository("repo/blah");
GHPullRequestSearchBuilder query = repository.searchPullRequests();
targetLabels.forEach(query::label);
PagedSearchIterable<GHPullRequest> list = query.isOpen().list();
List<GHPullRequest> candidatePullRequests = getCandidatePullRequests(list);
for (var pr : openPullRequests) {
    PagedIterable<GHPullRequestReview> reviews = pr.listReviews()
    var reviewSet = reviews.toSet();
}

If you place a breakpoint at /org/kohsuke/github/GitHubClient.java:461 and look at the connectorRequest you'll see the reviews URI it's calling is issue instead of pulls. This results in a 404 as no such endpoint exists.

Expected behavior
I should be able to retrieve a list of reviews from the pull requests.

Desktop (please complete the following information):

  • OS: macos
  • Version 1.318
@daniel-b2c2
Copy link
Author

daniel-b2c2 commented Feb 20, 2024

I see the issue has already been fixed here: #1779

Is it possible to release this to maven central please? 🙏 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant