If I have a GitHub issue number for a pull request, is that the same as the pull request number?
Asked Answered
R

2

6

When I create a pull request immediately after an issue, the pull request number is often 1 more than the issue number, which suggests that they share the same counter. As well, the Create an issue comment API seems to be the primary way for commenting back to the main discussion in a pull request, and API requests an issue_number. However, nothing on GitHub officially states that the issue number is equal to the pull request number.

Is there any official documentation or comment that verifies if an issue number for a pull request is equal to its pull request number?

Rhinencephalon answered 31/8, 2020 at 21:47 Comment(1)
Issues and PRs both take numbers from the same "pool". So if they're created at the same time they'll likely be consecutive, but it's not guaranteed (someone else might take the next value in-between). Not sure what you mean by "equal to" though, each number refers to either a PR or an issue.Earthenware
H
8

Issues, pull requests, and (if enabled) discussions are all numbered from the same pool. If you're using the API, using the pull request number for shared actions is the right thing to do:

Every pull request is an issue, but not every issue is a pull request. For this reason, "shared" actions for both features, like manipulating assignees, labels and milestones, are provided within the Issues API.

Hearth answered 1/9, 2020 at 1:41 Comment(0)
A
4

Yes, they share the same numbers.

You could also see when changing the number in the url (pull request url or issue url), it will redirect to the correct type (so issue or pull request)

It's some what documented here: https://docs.github.com/en/github/writing-on-github/autolinked-references-and-urls#issues-and-pull-requests

Issue or pull request URL

...

Short link

#26

Atwekk answered 31/8, 2020 at 21:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.