Repository redirects in API v4 GraphQL


#1

If a repo was changed, v3 would redirect the call automatically

Announcement: https://developer.github.com/changes/2015-04-17-preview-repository-redirects/
Docs: https://developer.github.com/v3/#http-redirects

However this doesn’t seem to happen in v4 and can’t find anything related to redirection or renaming in the docs.

For example, this is the old URL:
https://github.com/domchristie/to-markdown/pull/187

And it’s redirected to:
https://github.com/domchristie/turndown/pull/187

But this GraphQL errors:

{
  repository(owner: "domchristie", name: "to-markdown") {
    pullRequest(number: 187) {
      state
    }
  }
}

#2

Thanks, @bfred-it, that’s a good observation. This does seem like a discrepancy that should be addressed!

I’ve opened up an issue for it internally, and we’ll ping back here when we’ve got updates.


#3

I am sorry, but is this issue still outstanding or has a fix been put in place yet?


#4

+1, any suggestions how to deal with this, or any ETA when this will be tackled from Github side @kytrinyx ? This is very pesky to deal with as it stands, since repo references can just vanish and as opposed to the way this worked on v3 they won’t magically “auto-heal”


#5

Hi @robbywashere and @colszowka, thanks for the bump on this. We’ve re-prioritized the issue internally.

One workaround would be to use the Global Relay ID to identify the repo, since that will remain the same no matter what. However, you can’t use this to backtrack from a repo reference that has vanished - you’ll have to have the ID before the repo is renamed.


#6

@rlinehan Thanks for the update! Unfortunately, in my case the relay ID will not help since I’m getting the repo reference from rubygems metadata, and so no way for me to upfront find the relay ID


#7

Ah, got it. That makes a lot of sense, and the information about your use case helps us prioritize this. Thanks!


#8

That’s great to hear, thank you! For now I hacked around the issue by issuing a single http HEAD request to the actual repo url, which gives me all the info to handle the repo data, but I’d really prefer to use an official solution :slight_smile:


#9

Any update on official support for redirect?