Open wesngu28 opened 10 months ago
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
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.
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.
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
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