I would like to create a link to the Github Issue/PR that's behind a given hash number - without knowing whether what's behind the ID is an issue or a PR.
Basically, I'm looking for a URL that forwards the following query: something.com/USERNAME/REPOSITORY/NUMBER into either github.com/USERNAME/REPOSITORY/pull/NUMBER or github.com/USERNAME/REPOSITORY/issues/NUMBER, depending on which one of the two exists.
Github does this automatically on Github, but is there a URL that one can look up without requiring to first look up whether it's an issue or PR? (see here if what I'm explaining is not sufficiently clear).
I looked at Github docs but couldn't find anything. It would be simple to write an API for this, but I was hoping someone, maybe even Github, has done so already. Github definitely has code to do the lookup - it might just not be documented.
Looking at browser dev tools, I found out how Github's website does it. They query the following endpoint:
/suggestions/issue?issue_suggester=1&repository=REPOSITORY&user_id=USERNAME&q=NUMBER
However, this needs to be parsed first as it returns not a URL but a full list of suggestions.