Search filter for Github issues to find issues that have merged PRs

Good day!

Looking for such a filter for report purpose:

closed issues that have associated PR with status merged, and within selected date

Thanks a lot

3 Likes

Hi @pavelciapa,

Thanks for being here!

The search API can search “merged pull requests” with “is:merged” operator.
 https://help.github.com/articles/searching-issues/#search-based-on-the-state-of-an-issue-or-pull-req…

Thanks for your attention, but not quite what I am looking for.

“merged pull requests” with “is:merged” operator is to search only PRs. But I need to search Issues, that have attached (binded?) PRs, that are merged. If that is possible Thanks :slight_smile:

Here is what you searched about : https://github.community/t5/How-to-use-Git-and-GitHub/How-to-search-issues-having-referenced-pull-request/m-p/11370#M3708

Thanks for the clarification, I think your best bet is using the API, then looking for issue closing commits. 

1) List issues for a repository

  1. Iterate over the repository issues. For each issue, list events using the Events API. Parse the response for each event to identify events where issues were closed by commits. See the Event object’s closed key and the commit_id Event attribute for more details.

  2. Iterate over the list of issue-closing commits. For each issue-closing commit, list pull requests associated with the commit using the Repo Commits API. This will give you a mapping of Issue-closing commit => Pull Request.

  3. Reverse the Issue-closing commit => Pull Request mapping, so that you have a mapping of Pull request => issue-closing commit. Merge unique keys (Pull Requests) to create a report of Pull Requests => all issue-closing commits per Pull Request.