Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 5

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

4 Replies
Community Manager
Message 2 of 5

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

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...


Best,
AndreaG

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!

Copilot Lvl 2
Message 3 of 5

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

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 :)
Community Manager
Message 4 of 5

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

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

 

2) 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.

 

3) 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.

 

4) 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.


Best,
AndreaG

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!

Copilot Lvl 2
Message 5 of 5

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