Display "Used by" data in Showcase for GH repositories
Prerequisites
- [X] I have searched for duplicate or closed feature requests
- [X] I have read the contributing guidelines
Proposal
Display "Used by" data on the Showcase page for GtiHub repositories.
Example in the following screenshot provided by GitHub assets:
Motivation and context
This information can be really useful to see if the project is actually already used or not without going to GitHub.
After a bit of research, this seems to not be "properly" doable at the moment.
The Repository object accessible through the public GraphQL API (note that the same applies to the REST API) does include a dependencyGraphManifests. This field is only available under the access to a repository's dependency graph preview, altho this can be easily added to the existing script:
this.#query = octokit.graphql.defaults({
headers: {
authorization: `token ${process.env.GITHUB_TOKEN}`,
},
+ mediaType: {
+ previews: ["hawkgirl-preview"],
+ }
});
Note The GraphQL schema members under preview cannot be accessed via the Explorer so this can only be tested locally.
Unfortunately, the DependencyGraphManifestConnection provided by the API when using this preview only contains dependencies but not dependents which is what we are looking for here to mimick the Used by section.
I would assume that this is only a matter of time before this is added to the API as this is a preview feature, but for now, this is not possible.
An alternative could be fetching the https://github.com/owner/repo/network/dependents page (example) and grab that information from the HTML, but I am personally not a huge fan of this approach.
when using this preview only contains dependencies but not dependents which is what we are looking for here to mimick the Used by section.
It rings a bell! If I remember well, I was stuck here as well while looking for a solution.
An alternative could be fetching the https://github.com/owner/repo/network/dependents page (example) and grab that information from the HTML, but I am personally not a huge fan of this approach.
Yep, I agree.
Thanks a lot for looking at this issue, I'm going to put it "on hold" waiting for an API update.