Get referenced pull request from issue #24367
-
Hey Community, Github allows to see if pull requests reference an issue (or vice versa), e.g. see the following example (randomly picked): issue with referenced pull request This is great and I’m wondering if I can achieve the same via the API. While the API (v3) allows to see if commits are referenced in the issue (via its events) I wasn’t able to find a way to get referenced pull requests. I went through a couple of sources (e.g. here). Is this even possible? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
You’re correct. I wasn’t able to find a way to do what you’re asking via the REST API. But here’s a query that works for the GraphQL API:
which results in:
I hope that helps! |
Beta Was this translation helpful? Give feedback.
-
Thanks for your answer! Based on your query I played around with the v4 API and came up with something different which suits me better:
In this case I get every referenced Pull Requests and not only those which closed the issue. Thanks again! |
Beta Was this translation helpful? Give feedback.
-
Awesome! Thanks for sharing your ultimate solution back 😀 |
Beta Was this translation helpful? Give feedback.
-
Hi, I am adding to this thread since the problem I am facing is similar. For example, looking at this issue #11803, there is a PR mentioned in this comment.
Result:
I have also tried exploring the different This also does not solve it:
|
Beta Was this translation helpful? Give feedback.
-
I wrote an elegant solution in Python as well: https://github.com/orgs/community/discussions/24492#discussioncomment-7469561 |
Beta Was this translation helpful? Give feedback.
You’re correct. I wasn’t able to find a way to do what you’re asking via the REST API. But here’s a query that works for the GraphQL API:
which results in: