如何获取问题的拉取请求参考

How to get pull requests references for an issue

鉴于 GitHub 问题,是否有任何方法可以通过 API 获取引用该问题的拉取请求?

该信息显示在 GitHub html 页面中,但我在 API 文档中看不到任何内容。

真的可以吗?

is there any way to get the pull requests that reference to that issue via API

不直接。
即使是 reverse is not possible,作为拉取请求也有一个 link 'issue' 指向......它自己。

但如the issue API所述:

In the past, pull requests and issues were more closely aligned than they are now.
As far as the API is concerned, every pull request is an issue, but not every issue is a pull request.

This endpoint may also return pull requests in the response. If an issue is a pull request, the object will include a pull_request key.

因此您需要列出拉取请求的评论(使用 Issue Comments API 因为对 PR 的评论是用它完成的),并解析所述评论以找到对问题的引用。