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

How to find a pull request using the Search API and get its details? #298

Closed
adamsiemion opened this issue Oct 17, 2016 · 1 comment
Closed

Comments

@adamsiemion
Copy link

Is there a quicker/better way to get a GHPullRequest instance from searchIssues() results?

I have gotString sha1 and GHRepository repository instances and the following code:

final PagedSearchIterable<GHIssue> list = githubClient.searchIssues().q(sha1).list();
final GHIssue issue = list.iterator().next();
final String pullRequestUrl = issue.getPullRequest().getUrl().toString();
final int pullRequestNumber = Integer.valueOf(pullRequestUrl.substring(pullRequestUrl.lastIndexOf('/')+1));
final GHPullRequest pullRequest = repository.getPullRequest(pullRequestNumber);
@kohsuke
Copy link
Collaborator

kohsuke commented Nov 17, 2016

We have a mailing list for Q&A https://groups.google.com/forum/#!forum/github-api, so let's not use issue tracker for questions. Thanks!

@kohsuke kohsuke closed this as completed Nov 17, 2016
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

2 participants