Can I use an issue number to get pull request information?

I am receiving an issue ID via an issue_comment event. This event is sent in response to a pull request comment. Can I use the issue number as the pull_number argument for octokit.pulls.get()? E.g.

octokit.pulls.get({
  owner: context.repo.owner,
  repo: context.repo.repo,
  pull_number: context.payload.issue.number
});

(full context: https://github.com/neverendingqs-sandbox/gh-action-node-update-deps-test/blob/dd2b8d8b861a0921142325d024a19649363fcdbf/.github/workflows/gh-action-terminal.yml#L20-L32)

Hi 👋

Just of the bat I’m guessing not, since the issue number and pull request numbers increment the same reference, so for a “clean” repository, so to speak, if you create an issue it will have the reference #1 if you then create a pull request, that will have the reference #2 and so on. So there won’t ever be a pull request having the same reference number as an issue, and I’m pretty sure that’s by design, otherwise when you type #{ref} in an issue or pull request they won’t know if you mean the issue or pull request.

So each time you create an issue or pull request the reference will increment, and I’m pretty sure projects increment the same reference as well.

There might be a way if the pull request reference number is in the issue context somewhere, for instance context.payload.issue.reference.number or something, I’m just spitballing ideas.

My guess would be to debug the issue payload to see what’s inside it or look at the toolkit documentation if you can find the site for it, all I found was what’s in the repo toolkit/docs

Hope that helps a bit. :slightly_smiling_face: