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

Star history #8

Open
wesngu28 opened this issue Sep 1, 2023 · 4 comments
Open

Star history #8

wesngu28 opened this issue Sep 1, 2023 · 4 comments

Comments

@wesngu28
Copy link

wesngu28 commented Sep 1, 2023

A feature that I think could be implemented and cool to have would be a star history graph, probably a small one, that would give a brief glance to how a repository may be growing or trending over time.

This data can be pulled using the github api,
by listing stargazers, which can also give the date of a star which lets you reconstruct the repo's star history at various points in time.

EDIT: Not sure if star date is supported by the starrable interface in the graphql api

@mkitzmann
Copy link
Owner

Thank you @wesngu28 for this great idea!
I looked a bit into it and it seems to be a bit more complex, since you can only get 100 stargazers at a time using the API.

You could use the REST API:
https://api.github.com/repos/awesome-selfhosted/awesome-selfhosted/stargazers?per_page=100

or the GraphQL API:

{
  repository(name: "awesome-selfhosted", owner: "awesome-selfhosted") {
    createdAt
    stargazers(first: 100) {
      edges {
        starredAt
      }
    }
  }
}

In either case you would have to send many requests for all the 1200 repos with a lot of them more than 10k stars.

Other resources I have found:
https://github.com/star-history/star-history
https://stackoverflow.com/questions/61360705/construct-star-history-from-github-api?rq=2
https://docs.github.com/en/graphql/reference/interfaces#starrable
https://github.com/ansonyao/monthlyStarHistory

@wesngu28
Copy link
Author

wesngu28 commented Sep 8, 2023

Interstingly enough, it seems like star history kind of just gives up after 40k, or at least as far as I can tell.

https://star-history.com/#netdata/netdata&Date

Looking at netdata, after netdata hits 40k stars in 2019, there's just a line with no points until the current star count. This could probably be implementable with the rest api, and since the star graph would be small and similar in size to the commit graph it wouldn't be so unsightly, but its up to you.

@mkitzmann
Copy link
Owner

I will definitly look into how this could be done. I might try to get GitHub to add a GraphQL resolver so this could be done more efficiently.

@wesngu28
Copy link
Author

wesngu28 commented Jan 3, 2024

An alternative way to display the information would be using a wrapper like the one offered and talked about here https://star-history.com/blog/how-to-use-github-star-history and just embedding the provided image.

With pagination it will also limit the amount of requests made at one time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants