Get all issues linked to a pull request

There is a way to get the list of all the issues that are linked, at least, to a pull requests ?


You can get the comments currently (which would include the linked issues if they are added there). I suggest reaching out to GitHub support since they just rolled out the ability to Link Issues through the actual GitHub UI but I don’t see the corresponding API here: under the issues section. 

Hi Logan -

I am trying to do this as well, and it actually does not appear that the comments include any linked issues - the comments only appear to include actual comments, and not the conversation snippets regarding connected PR’s.

I set up a “catchall” webhook on the repo, and it also does not appear that linking a PR to an issue is even captured by a webhook.

Can anyone offer any insight as to how to capture this information (linking a PR to another issue)?

I need the same functionality.

I’ve looked into Issue/PR Events, Comments, and Timelimes but nothing shows up wrt to Linked Issues.

I’ve also tried searching but to no avail e.g. the following API search request yields an error:

The “linked:pr” is supposed to return issues linked to PRs (it works in the GH UI).


I’m also in need of this functionality via the API.  

I can currently use the API to track which commits occurred between commit X and commit Y (by walking the parent commits), and trace those commits to PRs, but I can’t trace those PRs to the linked issues they resolve.  

This API addition would allow our org to trace fixes much more easily!

1 Like

There’s no direct way of getting a list of Issues linked to a Pull Request.

But each Pull Request includes a timeline of events and one of those events is when an Issue gets linked. Using the timeline of events I was able to write a GitHub APIv4 API request and some javascript to get the Issues linked to a PR:

First, here’s the GraphQL query:

  resource(url: "") {
    ... on PullRequest {
      timelineItems(itemTypes: [CONNECTED_EVENT, DISCONNECTED_EVENT], first: 100) {
        nodes {
          ... on ConnectedEvent {
            subject {
              ... on Issue {
          ... on DisconnectedEvent {
            subject {
              ... on Issue {

If you run this in the GitHub GraphQL Explorer (, you’ll see all the events that an Issue was connected and disconnected to a Pull Request.

Using that query, I pass the response to this code that I wrote for a nodejs app that then determines which Issue is still linked to the Pull Request

const issues = {}; => {
    if (issues.hasOwnProperty(node.subject.number)) {
    } else {
        issues[node.subject.number] = 1;
const linkedIssues = [];
for (const [issue, count] of Object.entries(issues)) {
    if (count % 2 != 0) {


The logic here is as follows:

  1. Get a list of all events on a Pull Request of the type CONNECTED_EVENT and DISCONNECTED_EVENT
  2. Create a map, keyed by Issue number and keep a count of how may times the issue is CONNECTED and DISCONNECTED
  3. From that map, look for keys that have an odd-numbered count, as these are the events that have been CONNECTED that don’t have a corresponding DISCONNECTED event.

It’s not a super elegant solution, but it solves what I need, which was to find those Linked issues.

Hopefully this helps someone else out 


It should be noted that this is not foolproof. I have a number of linked issues from the main description which aren’t displayed in the timelineItems

I had a similar problem link, my workaround was as follows:

First I grabbed the “html_url” for the issue, retrieved the contents of the URL and used an HTML parser to grab the div with class “css-truncate my-1” and then the href of the anchor within that. The href is a relative URL to the linked pull request. With that, I could break up the path and get the pull number, and use that number to retrieve the pull request information via the REST API.

It’s brittle, but it’s working…

I also have a use case for this problem:
I would like to add a Verify label to all the issues linked to the PR after the PR is merged. Is there any way of doing that at the moment?