-
-
Notifications
You must be signed in to change notification settings - Fork 23.6k
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
[Feature] Detect private repositories in Top Languages card #174
Comments
Hmm i see, so you have 3 public repos 2 of them are forked and 1 is a profile readme thats why languages are not shown. So in case of private repos, Yes you can deploy on your own vercel instance and fork/modify the code to show your private repo languages. |
Hello @Nathan13888 What you are asking will not be possible with @anuraghazra hosted version, this is because the graphql query will check the Repository object and will count the languages if a repository is not a fork (Line 11 of fetchTopLanguage). The only way for you to get the languages on your private repos count towards your stats would be to host the project yourself - this is because when you use your own API key you will have access to all your private data anyway. Also note that the languages counter will check if a repository is not a fork so it will only count repos that were created by you and not a fork from another project. We could count all the repos instead but that will just make @anuraghazra hit the api limits quicker I believe. I guess as a work around you could fork this repo, change the query on fetchTopLanguages to turn the Line 11 of fetchTopLanguage to true and should start count the languages of your forked projects. Hope this helps 😄 👍 |
Actually we have multiple Personal Access Token Fallbacks (see #58) so it's unlikely that we will hit the rate limit, the main issue is performance, fetching all the repos will take time and since github api paginates the response to 100 repos we actually have to do multiple requests to get all the repos and that would take some time and it runs on free tier of vercel so the serverless function will fail after 10 seconds, i know 10 seconds sounds too much but surprisingly enough it's not, this is the reason why the #15 is pending.
Yes we skip over forks, because forks are not the right metric imo, because a user can fork as many as big repos they want and if we count that in the stats will be too biased. |
Didn't know about that but that's a great way to do things! Also I do agree that we should skip forks, this was mostly to try and help @Nathan13888 question/request haha |
@FabioRosado Yup! 👍 @Nathan13888 I think the best approach is to fork and modify the code on your end, let me know if that solves your query and we can close this for now. |
My hosted project This project Shows the same value. So it doesn't count private repos. |
If it counted private repos, i would've had a high javascript % as i work on javascript private projects |
I've actually tried hosting my own vercel instance already but it doesn't work still. @anuraghazra So the solution from the previous feature request that @FabioRosado suggested doesn't seem to work here. Could there potentially have been some sort of secret API or setup that allows for this to work? |
I've added a self-deployed/hosted version of the repository for reference on my profile picture. |
@Nathan13888 @MirayXS as I said, you have to modify the code so that it also counts private repos, it does not just magically work just by using your own PAT.
|
I already have a fork and hosted instance. What code and lines I have to modify ? |
@MirayXS setting isFork: true should work
|
@anuraghazra If everything is as that easy... It'll be a huge project to clone those repos and count. |
It's not about huge projects or cloning repo in order to fetch & calculate the data. all is done from |
I haven't done anything like this before. 😨 You mean this one? https://docs.github.com/en/graphql |
Everything is magic then 😉 You can explore the API here: Also check out the code please: github-readme-stats/src/fetchTopLanguages.js Lines 5 to 27 in f50938c
|
i want to only count private |
trying
on api explorer shows private repos fine without needing the isFork value to be true. When trying the languages query in the API Explorer I did have to change the language(first:1) to (first:10) to get details on more languages, havent looked at the rest of the source code to see if it would make any difference in this issue though. In any case the language tracker does not seem to work the same way. As a sidenote i have this weird difference while deploying on my own (1st pic is from your api, second from mine) |
@odieone44
Probably because your instance is using your own PAT so it's also fetching all the private contributions and stats. |
@anuraghazra OMG. I was meant to post these things under #168 ... Found this just now... But I do not know GraphQL API. |
|
After you host an instance (with the latest code), you need to create an access token which has the "repo" scope. This will include your private repositories in the calculation. You don't need to change any code. @MirayXS Try the following in https://developer.github.com/v4/explorer/ to see which repositories & languages will be used in the calculation.
You can also modify the query (src/fetchers/top-languages-fetcher.js) to exclude a certain type of repositories, for example, to exclude archived ones you would use "isArchived: false", the same way the forked repositories are currently excluded. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Is your feature request related to a problem? Please describe.
Top Languages Cards do not display anything about private repositories even when using a self-deployed Vercel instance.
Since the majority of my repositories are private and any public repositories are either forks or don't have any particular "Language" being used, the Top Languages Card appears to be blank (view my profile for details).
Describe the solution you'd like
Include private repositories when generating the Top Languages card.
Describe alternatives you've considered
No other than not using this feature.
@FabioRosado Do you have any ideas?
The text was updated successfully, but these errors were encountered: