You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Depending how a GitHub Release is created, a Release.Tag.Target can either refer to a Commit object or to a Tag object. To retrieve the target Sha1 of the Release, inline fragments are required in a GraphQL query.
It doesn't currently seem possible to reproduce this using the Octokit.GraphQL library as the Switch<> syntax is not available on Target's object type (which is IGitObject), nor on it's parent Tag's object type (which is Ref ... just in case there was syntactic sugar going on somewhere).
Relevant information
Here's some GraphQL that reproduces this:
query releases {
repository(owner:"MyOrg", name:"MyRepo") {
releases(
first:2
orderBy:{field: CREATED_AT, direction:DESC}){
nodes{
name
createdAt,
publishedAt
tag{
name
target{
... on Commit{
oid
}
}
target {
... on Tag {
target {
... on Commit {
oid
}
}
}
}
}
}
}
}
}
Please note that I am unable to provide you with a public example of this in the real world as I'm using GitHub Enterprise. However here is a (redacted) version of the results when this is run against my server:
Well, if you're using the latest nuget package I don't think they have published the commit with the Union Types - looks like the last version was end of October, and union types were merged November.
However, in the code I still don't think they have a Selector on that IGitObject. The same is true of RepositoryOwner, which is an IRepositoryOwner in graphql.net - as far as I can tell you cannot type switch on the owner or organization, and pass the correct concrete type back.
I don't actually see how you would identify what type of owner you got back using this library, outside of guess-and-check users and if it errors, check orgs.
Am I missing something? Is there a simple way of returning __typename that makes all this go away?
👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!
Summary
Depending how a GitHub Release is created, a Release.Tag.Target can either refer to a Commit object or to a Tag object. To retrieve the target Sha1 of the Release, inline fragments are required in a GraphQL query.
It doesn't currently seem possible to reproduce this using the Octokit.GraphQL library as the Switch<> syntax is not available on Target's object type (which is IGitObject), nor on it's parent Tag's object type (which is Ref ... just in case there was syntactic sugar going on somewhere).
Relevant information
Here's some GraphQL that reproduces this:
Please note that I am unable to provide you with a public example of this in the real world as I'm using GitHub Enterprise. However here is a (redacted) version of the results when this is run against my server:
Based on your documentation, this is some pseudo code of what I would expect to be able to do:
I've had a look through the library code and as far as I can tell it's isn't supported. However, feel free to let me know if it's a PEBKAC error!
Thanks for reading.
The text was updated successfully, but these errors were encountered: