Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display "Used by" data in Showcase for GH repositories #32

Open
2 tasks done
julien-deramond opened this issue May 1, 2023 · 2 comments
Open
2 tasks done

Display "Used by" data in Showcase for GH repositories #32

julien-deramond opened this issue May 1, 2023 · 2 comments
Labels
feature Something can be improved on hold

Comments

@julien-deramond
Copy link
Member

Prerequisites

Proposal

Display "Used by" data on the Showcase page for GtiHub repositories.

Example in the following screenshot provided by GitHub assets:

Screenshot 2023-05-01 at 21 57 11

Motivation and context

This information can be really useful to see if the project is actually already used or not without going to GitHub.

@julien-deramond julien-deramond added enhancement New feature or request feature Something can be improved and removed enhancement New feature or request labels May 1, 2023
@HiDeoo
Copy link
Contributor

HiDeoo commented Jun 1, 2023

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.

@julien-deramond
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Something can be improved on hold
Projects
None yet
Development

No branches or pull requests

2 participants