Skip to content

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

@adamsiemion

Description

@adamsiemion

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);

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