Ability to fetch ReferencedEvents which did not originate from commits


#1

Hi there,

I’m building a product which leverages the references between PRs / issues / commits.

It looks like what I’m after should be found under PRs’ / issues’ timeline connection with type ReferencedEvents, but I’ve tried a few queries and I only find events which correspond to a PR or issue being mentioned in a commit message.

I also need to find the direct references between PRs / issues – i.e. when they’re referenced a comment using the format #pr_or_issue_number.

From the short description of ReferencedEvent and the fact that the commit field is nullable, it sounds like these events should be found here, but after trying out a few queries I’m exclusively getting references related to commit messages.

Please consider this a schema request or bug report, whichever is applicable :slight_smile:

Sample query:

query {
  repository(owner: "nodejs" name: "node") {
    issue(number: 13463) {
      timeline(first: 20) {
        edges {
          node {
            ... on ReferencedEvent {
                  actor {
                    avatarUrl
                    login
                    url
                  }
                  commit {
                    oid
                  }
                  createdAt
                  isCrossReference
                  subject {
                    ... on Issue {
                      number
                    }
                    ... on PullRequest {
                      number
                    }
                  }
                }
          }
        }
      }
    }
  }
}

I’m after the reference from PR #13447. All I get is the reference from f06c05c.


Issue ReferencedEvent missing
Bug in rate limit calculation for issue labels – excessive points consumed
#2

Hey @nomeyer!

Yep - I’m seeing the same thing! I’ve created an internal issue, and I’m going to work on this soon. It looks like the schema is missing what we call a “cross reference” event in the REST API.

We’re working on implementing this now - I’ll update this when it’s there!


#3

Hey @nickvanw, I investigated the REST API to consider using it while waiting for the GraphQL version, but discovered that the issue timeline endpoint is not available to GitHub Apps, which is unfortunately what we’re building.

Am I missing something, or do integrations aka “Apps” not have access to these events currently?

I think you mentioned that you had an implementation of CrossReferences internally and were getting close to making the field open externally – is that still the case, or should I look to implement a work around (most likely parsing PR & Issue comments for these cross references)? Will that field be available to GitHub Apps?

Thanks
Nick


#4

@nomeyer the issue timeline endpoint is not yet enabled for GitHub Apps. We’re in the midst of a full audit of all the REST API endpoints, and will report back here when we know more about the ETA for enabling it.

As far as I know, enabling an endpoint is all-or-nothing, so if we do open up the CrossReferences field, that will be available to GitHub Apps as soon as the endpoint itself is enabled.


#5

Hey @nomeyer!

Really sorry this one got caught up! I modified your query to get the record you were looking for, using the CrossReferencedEvent we just added:

{
  repository(owner: "nodejs", name: "node") {
    issue(number: 13463) {
      timeline(first: 20) {
        edges {
          node {
            __typename
            ... on CrossReferencedEvent {
              actor {
                login
              }
              source {
                __typename
                ... on Issue {
                  repository {
                    name
                  }
                  number
                }
                ... on PullRequest {
                  repository {
                    name
                  }
                  number
                }
              }
            }
          }
        }
      }
    }
  }
}

Returns:

{
  "data": {
    "repository": {
      "issue": {
        "timeline": {
          "edges": [
            {
              "node": {
                "__typename": "IssueComment"
              }
            },
            {
              "node": {
                "__typename": "LabeledEvent"
              }
            },
            {
              "node": {
                "__typename": "LabeledEvent"
              }
            },
            {
              "node": {
                "__typename": "LabeledEvent"
              }
            },
            {
              "node": {
                "__typename": "CrossReferencedEvent",
                "actor": {
                  "login": "refack"
                },
                "source": {
                  "__typename": "PullRequest",
                  "repository": {
                    "name": "node"
                  },
                  "number": 13447
                }
              }
            },
            {
              "node": {
                "__typename": "AssignedEvent"
              }
            },
            {
              "node": {
                "__typename": "ReferencedEvent"
              }
            },
            {
              "node": {
                "__typename": "ClosedEvent"
              }
            },
            {
              "node": {
                "__typename": "ReferencedEvent"
              }
            }
          ]
        }
      }
    }
  }
}

Thanks again for pointing this out, and let us know if this looks amiss!