Giter Site home page Giter Site logo

Comments (152)

developStorm avatar developStorm commented on May 17, 2024 64

Hey folks! I've made #1 (comment) available for stars on general stats card as well. The implementation again used ownerAffiliations and you can see detailed explanation of roles you may use here.

Use @franky47's stats card as demo (again 😆):

Only include repo they owned:
https://github-readme-stats-one-bice.vercel.app/api?username=franky47&show_icons=true&include_all_commits=true&count_private=true

Include all repos where they have write access to:
https://github-readme-stats-one-bice.vercel.app/api?username=franky47&show_icons=true&include_all_commits=true&count_private=true&role=OWNER,ORGANIZATION_MEMBER,COLLABORATOR

* It's not that accurate to say "have write access to". Check GitHub docs linked above for more precise description.

I'm not sure if this is enough to close this issue -- let me know for any thoughts!

from github-readme-stats.

Zethson avatar Zethson commented on May 17, 2024 45

Still relevant.

from github-readme-stats.

anuraghazra avatar anuraghazra commented on May 17, 2024 30

@franky47 great idea! okay i will look into it. and try to add org support. meanwhile you can also contribute if you want.

from github-readme-stats.

ngoldack avatar ngoldack commented on May 17, 2024 25

@anuraghazra I tried it in go and it worked like a charm to count those stars:

package main

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
)

type Org struct {
	Name string `json:"login"`
}

type Repo struct {
	Name  string `json:"full_name"`
	Stars int    `json:"stargazers_count"`
}

func main() {
	url := "https://api.github.com/users/mattetti/orgs"

	resp, err := http.Get(url)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		panic(err)
	}

	var stars int

	var orgs []Org
	json.Unmarshal(body, &orgs)
	for _, v := range orgs {

		url = fmt.Sprintf("https://api.github.com/orgs/%s/repos", v.Name)

		resp, err = http.Get(url)
		if err != nil {
			panic(err)
		}
		defer resp.Body.Close()
		body, err = ioutil.ReadAll(resp.Body)
		if err != nil {
			panic(err)
		}

		var repos []Repo
		json.Unmarshal(body, &repos)

		for _, v := range repos {
			fmt.Println(v.Name, v.Stars)
			stars += v.Stars
		}
	}
	fmt.Println("-----------------------")
	fmt.Println("### Total stars:", stars)
}

It's quite simple: you just get all org names from the api endpoint /users/${USERNAME}/orgs and then get all each repo from each org from the endpoint /orgs/${ORGNAME}/repos. Just count those stars together and you have it. But since I don't have the expierence in javascript I won't be able to implement this.

from github-readme-stats.

mainrs avatar mainrs commented on May 17, 2024 22

Assuming you might be a member of some huge organization (npm, babel, rust). It might make sense to add a filter on top of it to prevent certain organizations from being included. Better than that would be an allowlist that only includes organizations that you explicitly declare:
https://github-readme-stats.vercel.app/api/?username=SirWindfield?orgs=zors-engine,Spotifyd

from github-readme-stats.

conquerv0 avatar conquerv0 commented on May 17, 2024 22

Patiently waiting for an exciting update.

from github-readme-stats.

anuraghazra avatar anuraghazra commented on May 17, 2024 19

Hi @developStorm I'll consider your PR this weekend.
I'll consider it based on the reactions on your comments and majority of them.

from github-readme-stats.

mainrs avatar mainrs commented on May 17, 2024 17

Can people please stop constantly asking if this has been implemented or not? It doesn't drive development faster, it often puts pressure onto the maintainer that gets constantly reminded about this issue (and it's clear from the comments that the solution is not easy). And it notifies people that are subscribed to this thread that are interested in legitimate comments that either give feedback or bring up new ideas on how to solve the issue.

"+1", "is this implemented yet", "any updates" and similar comments are just unneccessary spam. If the feature would exist, the issue would be closed. It's that easy.

Thank you.

from github-readme-stats.

wleoncio avatar wleoncio commented on May 17, 2024 13

Maybe first let's see what the rest of the userbase/community thinks.

Well, can't speak for everyone, but I for one care very little about counting stars; I just wish my programming language breakdown card would reflect all my commits on GH (personal and org repositories; ideally even PR code in 3rd-party repos).

from github-readme-stats.

developStorm avatar developStorm commented on May 17, 2024 10

I was able to use the query params mentioned in my last comment to include org repo for top-langs card. Use @franky47's card as demo (since mine was a bit tricky🥲):

(role=OWNER as default)
https://github-readme-stats-one-bice.vercel.app/api/top-langs/?username=franky47&langs_count=10&layout=compact

https://github-readme-stats-one-bice.vercel.app/api/top-langs/?username=franky47&langs_count=10&layout=compact&role=OWNER,ORGANIZATION_MEMBER,COLLABORATOR

?role= could be any combination of repositoryaffiliation enum here: https://docs.github.com/en/graphql/reference/enums#repositoryaffiliation

from github-readme-stats.

terror avatar terror commented on May 17, 2024 9

Hi @deancn, it is because we currently only support stars from repositories you are the owner of. Since many people want this as an enhancement I'm sure we'll be able to implement this soon.

from github-readme-stats.

developStorm avatar developStorm commented on May 17, 2024 8

Sorry if this is bothering people on this thread.

@anuraghazra According to your reply in #1 (comment), in conjunction with the ongoing community interest in this feature (see this discussion and the recent #1035, #1172, #1243), would you consider merging my previously initiated PR #1122, at least as an interim workaround? As the code base changes over time, resolving code conflicts can become more cumbersome, so I would appreciate a final conclusion from you as soon as possible. Thanks for your time :-)

from github-readme-stats.

daolou avatar daolou commented on May 17, 2024 7

How long this feature could be used?

from github-readme-stats.

RubenMateus avatar RubenMateus commented on May 17, 2024 7

any news on this?

from github-readme-stats.

wleoncio avatar wleoncio commented on May 17, 2024 6

Just bought @anuraghazra a coffee in the name of this issue (and as a general "thank you" for making this wonderful piece of software). Maybe if more people chip in we can convince him to get this done before he gets a heart attack from all the caffeine. 😅

from github-readme-stats.

CircuitSacul avatar CircuitSacul commented on May 17, 2024 6

Has this been implemented?

from github-readme-stats.

sumchowd avatar sumchowd commented on May 17, 2024 6

While this issue is still open, I found another repository that provides this feature in the short term. Github Trends looks at individual commits as opposed to repository stats, so it counts contributions to open-source repos.

https://www.github.com/avgupta456/github-trends

from github-readme-stats.

Enaium avatar Enaium commented on May 17, 2024 6

While this issue is still open, I found another repository that provides this feature in the short term. Github Trends looks at individual commits as opposed to repository stats, so it counts contributions to open-source repos.

https://www.github.com/avgupta456/github-trends

but this still can't organization stats

from github-readme-stats.

maxlingenfelter avatar maxlingenfelter commented on May 17, 2024 6

Any updates on when this will be supported publicly?

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024 6

@PekayTab Thanks for your question. As explained in #1122 there are several changes that have to be applied before #1122 can be merged.

@developStorm Thanks for your detailed response. I have no problem merging this pull request. I have used it for months on my own GitHub readme. 🚀 That's why I have been trying to merge it into the main branch. I also don't care about cheating since, in the end, it is impossible to prevent😋. I only pointed out that:

  1. I think we should filter out the ORGANIZATION_MEMBER group. Having this group enabled will also add stars of repositories in my organizations to which I never committed. I think the COLLABORATOR will group will already resolve #1.
  2. It might be unwise to support ownerAffiliations for the language card due to the current implementation of the GraphQL API. The current API and the ownerAffiliations option enabled all languages in all repositories a user is a member of will be counted. This might not be a good indication of language fluency. However, if point 1 is fixed, I don't think it will be worse than the incorrect results we currently have for the language card. I think the exclude_repo option and #1732 will provide users with more than enough ways to fix their language card if they feel it is incorrect.

As a result, because this feature has been widely requested from the community since 9 Jul 2020, I'm good with merging this PR if the following things are fixed:

Nevertheless, since I'm not the owner of this project, I will leave this decision to @anuraghazra.

Originally posted by @rickstaa in #1122 (comment)

I'm however waiting for feedback of @anuraghazra before I applying these changes.

from github-readme-stats.

kaaax0815 avatar kaaax0815 commented on May 17, 2024 5

What is the status of this Feature?

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024 5

By including the ORGANIZATION_MEMBER param. People, can decide themselves which stats they want to show on each card.

My current setup is now as follows: I include the ORGANIZATION_MEMBER param in my "programming language breakdown card", since it better represents the languages I use daily. However, for the "GitHub stats" card, however, since this would add stars that I would not want to take credit for, I omit it.

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024 5

@guillaumearnx In that case, you need to create your own instance since a Personal Access Token needs to be present in the instance. I am happy to help if you run into problems. The following steps should get it working for you:

  1. Fork the https://github.com/anuraghazra/github-readme-stats repository.
  2. Follow the Vercel instance documentation to set up your own Vercel instance.
  3. Clone your fork to your PC git clone <FORK_SSH_URL>.
  4. Create a new branch git checkout -b org-stats.
  5. Add @developStorm remote to your remotes git remote add develop [email protected]:developStorm/github-readme-stats.git.
  6. Fetch the remote git fetch develop
  7. Merge @developStorm changes into your branch git merge develop/master.
  8. Push these changes to your remote git push.
  9. On Vercel you will see that an instance has been deployed for the org-stats branch.
  10. You can use the link that is shown for that deployment to create your cards.

So, I'm kinda a newbie on git and I was trying to follow your tutorial. Everything went fine until the 8th step (git push).

That's what I got when I tried to do that in the terminal:

fatal: The current branch org-stats has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin org-stats

To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.

So I tried the git push --set-upstream origin org-stats and everything (apparently) went fine, the Vercel deployed again, but my stats cards was still the same.

If possible, could you give me some help? And apologies in advance for the bothering, I'm completely layman with git.

For now, you should add the &role=OWNER,COLLABORATOR parameter to your card for the organization results to show up. This is not yet documented since this feature has not yet been merged into the master branch. I will probably change it to &include_orgs when we release it. You can checkout my README for an example.

from github-readme-stats.

daolou avatar daolou commented on May 17, 2024 4

@Mr-jiangzhiguo, strangely when I go to your Github profile, I also can't see your organizations.
I tried mine (curl https://api.github.com/users/mre/orgs) and it works. 🤔

I got it, settings is private
image

from github-readme-stats.

anuraghazra avatar anuraghazra commented on May 17, 2024 4

Just bought @anuraghazra a coffee in the name of this issue (and as a general "thank you" for making this wonderful piece of software). Maybe if more people chip in we can convince him to get this done before he gets a heart attack from all the caffeine. 😅

😄 haha thank you for coffee.

Well yeah probably only viable way to get this issue done is to change the fetching system, like instead of fetching on the fly with serverless functions, we can create a github action to fetch the data, this way serverless functions won't timeout and we can fetch more data looping over all the organizations.

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024 4

@wleoncio Excellent point! I missed noticing that #1122 also influences the behaviour of the "programming language breakdown card". In that case, based on #1 (comment), I think the benefits of accepting the ORGANIZATION_MEMBER param outweigh the prevention of cheating.

from github-readme-stats.

wleoncio avatar wleoncio commented on May 17, 2024 4

My current setup is now as follows: I include the ORGANIZATION_MEMBER param in my "programming language breakdown card", since it better represents the languages I use daily. However, for the "GitHub stats" card, however, since this would add stars that I would not want to take credit for, I omit it.

Sounds like a good solution for now. I'll be doing the same, plus adding exclude_repo to filter out org repos that obviously skew my card (basically, projects I am not a major contributor to) and hide to exclude languages that I don't code in but still show up due to peer contribution.

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024 4

@guillaumearnx In that case, you need to create your own instance since a Personal Access Token needs to be present in the instance. I am happy to help if you run into problems. The following steps should get it working for you:

  1. Fork the https://github.com/anuraghazra/github-readme-stats repository.
  2. Follow the Vercel instance documentation to set up your own Vercel instance.
  3. Clone your fork to your PC git clone <FORK_SSH_URL>.
  4. Create a new branch git checkout -b org-stats.
  5. Add @developStorm remote to your remotes git remote add develop [email protected]:developStorm/github-readme-stats.git.
  6. Fetch the remote git fetch develop
  7. Merge @developStorm changes into your branch git merge develop/master.
  8. Push these changes to your remote git push.
  9. On Vercel you will see that an instance has been deployed for the org-stats branch.
  10. You can use the link that is shown for that deployment to create your cards.

from github-readme-stats.

FLAK-ZOSO avatar FLAK-ZOSO commented on May 17, 2024 4

@KendallDoesCoding, I really hope that. I've never committed anything in this repository, so I don't even know how much complicated it would be, but I'm sure it would be useful.

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024 4

@joaovian06 Hope my comment above helps!

A small note for everyone. Altough I understand the importance of this feature, please be aware that @anuraghazra maintains this project in his free time. 🏅🚀 Bumping this issue will therefore not speed up the process but will put stress on the collaborators of this repository. If you want this feature implemented, it is best to show your support using the like buttons under the first comment. If you have questions or suggestions about implementing this feature, feel free to comment on the pull request: #1122.

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024 4

You can also already use this feature with the syntax shown below. Please, be aware that since this feature is not yet merged, the exact syntax is changed, so it is better to fork the repository, deploy your own Vercel instance and use the master_orgs branch.

Without org stats

Anurag's GitHub stats

[![Anurag's GitHub stats](https://github-readme-stats-git-masterorgs-github-readme-stats-team.vercel.app/api?username=rickstaa)](https://github.com/anuraghazra/github-readme-stats)

Top Langs

[![Top Langs](https://github-readme-stats-git-masterorgs-github-readme-stats-team.vercel.app/api/top-langs/?username=rickstaa)](https://github.com/anuraghazra/github-readme-stats)

With org stats

Anurag's GitHub stats

[![Anurag's GitHub stats](https://github-readme-stats-git-masterorgs-github-readme-stats-team.vercel.app/api?username=rickstaa&include_orgs=true)](https://github.com/anuraghazra/github-readme-stats)

Top Langs

[![Top Langs](https://github-readme-stats-git-masterorgs-github-readme-stats-team.vercel.app/api/top-langs/?username=rickstaa&include_orgs=true)](https://github.com/anuraghazra/github-readme-stats)

from github-readme-stats.

anuraghazra avatar anuraghazra commented on May 17, 2024 3

Hey @developStorm this is great thanks for this.

Although I do have a question, it's a philosophical question matter of fact.

Like for example, I'm member of reakit organization because I contributed code to it,
but is it fair to count all of the 4.8k stars as MY stars??? Technically those stars aren't gained by me, those are gained by the reakit organization.

Now if I'm added as a COLLABORATOR to the repo then maybe you can say "okay yes I gained those stars"
But in case of ORGANIZATION_MEMBER it's a totally different thing.

from github-readme-stats.

developStorm avatar developStorm commented on May 17, 2024 3

Hi @anuraghazra thanks for the explanation.I think the typical case where COLLABORATOR and ORGANIZATION_MEMBER· will be used is when some users only use the organization to organize their repo. i.e. The main (if not the only) contributor of these repositories is still the user themselves, even if the repository is under some org. In that case I think it's reasonable for them to say those stars are gained by themselves. This scenario is also mentioned several times in #1.

I don't think it's necessary to overthink anti-cheating as an open source stats project. It's entirely possible for a intended user to create fake data by manually modifying the source code or SVG, etc. - no need to go through such a troublesome as joining/contributing to the organization.

Hope this makes sense ✨

from github-readme-stats.

KendallDoesCoding avatar KendallDoesCoding commented on May 17, 2024 3

@KendallDoesCoding, I really hope that. I've never committed anything in this repository, so I don't even know how much complicated it would be, but I'm sure it would be useful.

Yeah, I want to use it for my organization personally.

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024 3

Hey @mendax1234, thanks for your interest in this feature. Although it is not officially supported yet, I already use it on my fork (see my readme). The steps for using this feature are found here.

Unfortunately, I can not give an ETA for this feature (see #1 (comment) for more information).

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024 3

@RuiGuilherme If you followed these steps for deploying your own private instance and added a PAT that has access to the repositories of these private organizations, it should work. The permissions are the same as in the GraphQL Explorer when you're logged in (see #1770 (comment)).

from github-readme-stats.

brunolnetto avatar brunolnetto commented on May 17, 2024 3

The feature seems mature at this level. Who and when will we merge it on main repository?

from github-readme-stats.

deancn avatar deancn commented on May 17, 2024 2

@terror got it, thanks.

from github-readme-stats.

MrTroble avatar MrTroble commented on May 17, 2024 2

I would prefer to use a whitelist for that, that would also make it more straight forward and light (probably?)

For example:
https://github-readme-stats.vercel.app/api?username=MrTroble&?orgs=Troblecodings&show_icons=true&theme=radical

This would go through the repos of Troblecodings and would account for all stars in those. This shouldn't take to long should it?

from github-readme-stats.

developStorm avatar developStorm commented on May 17, 2024 2

This looks promising, but when I do mine I get what looks like the language breakdown of all the code in my org repos, not of the code I contributed. I tried other combinations of parameters on that enum page but couldn't get to what I want. 😕

That' s right. The API endpoint used here can only get the language distribution for the whole repository but not only for individual's contribution 🤒 It is difficult to do what you say based on the existing queries.

Since GitHub doesn't seem to have such statistics, I'm worried that the only thing we can do is probably just iterate through all the repositories for all the commits of a given user and calculate the language. And that would be very, very time-consuming - Vercel probably won't do it. I'd be happy to try to implement it if there is a way to get the language distribution data for a single user directly from GitHub API.

(We could exclude some specific repos with exclude_repo param though, if only a few repos is interfering the data)

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024 2

@developStorm thanks again for creating #1122. I think it is a very valuable addition to the github-readme-stats tool.

Here my two cents on the matter. I think I agree with @anuraghazra that removing the ORGANIZATION_MEMBER option would increase the design integrity of the github-readme-stats tool. However, as you said, if people want to cheat, they always find a way to do so. Therefore if this requires you to add a lot of code, it might not be worth it since it complicates the codebase. Maybe first let's see what the rest of the userbase/community thinks.

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024 2
  1. git add remote develop [email protected]:developStorm/github-readme-stats.git

@rickstaa fatal: pathspec 'remote' did not match any files <--@phpstorm

Makes sense. It should be git remote add develop [email protected]:developStorm/github-readme-stats.git small typo.

from github-readme-stats.

nyxb avatar nyxb commented on May 17, 2024 2
  1. git add remote develop [email protected]:developStorm/github-readme-stats.git

@rickstaa fatal: pathspec 'remote' did not match any files <--@phpstorm

Makes sense. It should be git remote add develop [email protected]:developStorm/github-readme-stats.git small typo.

I made it easier for myself and foked yours. since I adjusted something and started my vercel instance. 😁

from github-readme-stats.

metaskills avatar metaskills commented on May 17, 2024 1

Oh yea... good point. Without a in your markdown, you can click it (views svg) then click it again. But easier to put the links in your markdown I suspect.

from github-readme-stats.

changkun avatar changkun commented on May 17, 2024 1

eager to have this.

from github-readme-stats.

wleoncio avatar wleoncio commented on May 17, 2024 1

This looks promising, but when I do mine I get what looks like the language breakdown of all the code in my org repos, not of the code I contributed. I tried other combinations of parameters on that enum page but couldn't get to what I want. 😕

from github-readme-stats.

CircuitSacul avatar CircuitSacul commented on May 17, 2024 1

@sirwindfield you're right, sorry about that. My intention wasn't to put any pressure on the developers, I just couldn't tell from the comments whether or not it had been implemented (though I guess I should've noticed the issue was still open).

from github-readme-stats.

metaskills avatar metaskills commented on May 17, 2024

I did that in my fork on AWS Lambda. For the pin.js I did:

      query: `
        fragment RepoInfo on Repository {
          name
          owner {
            login
          }
const renderRepoCard = (repo) => {
  const owner = repo.owner.login;
<text x="50" y="38" class="header"><a class="header" href="https://github.com/${owner}/${name}">${name}</a></text>

You can see too that I added an <a> link to the repo name too.

from github-readme-stats.

anuraghazra avatar anuraghazra commented on May 17, 2024

Will it actually show the stats including all the Orgs?

from github-readme-stats.

anuraghazra avatar anuraghazra commented on May 17, 2024

@metaskills Also yes that link would work but will it work in github readmes? Hmmm i dont think soo because it is served as image not as raw html elements. 🤔

from github-readme-stats.

anuraghazra avatar anuraghazra commented on May 17, 2024

Yes just wrapping the markdown image inside a link is a good way.

from github-readme-stats.

FairyEver avatar FairyEver commented on May 17, 2024

I really hope to have this function, which can count my stars in the organization!

from github-readme-stats.

deancn avatar deancn commented on May 17, 2024

my stars value is 0, can help check?

https://github-readme-stats.vercel.app/api/?username=deancn

from github-readme-stats.

ngoldack avatar ngoldack commented on May 17, 2024

Any update on this?

from github-readme-stats.

daolou avatar daolou commented on May 17, 2024

@ngoldack

this api /users/${USERNAME}/orgs seemingly inaccurate
for example https://api.github.com/users/Mr-jiangzhiguo/orgs get [],
but in fact, it has 3 public orgs
image

from github-readme-stats.

mre avatar mre commented on May 17, 2024

@Mr-jiangzhiguo, strangely when I go to your Github profile, I also can't see your organizations.
I tried mine (curl https://api.github.com/users/mre/orgs) and it works. 🤔

from github-readme-stats.

anuraghazra avatar anuraghazra commented on May 17, 2024

It's quite simple: you just get all org names from the api endpoint /users/${USERNAME}/orgs and then get all each repo from each org from the endpoint /orgs/${ORGNAME}/repos. Just count those stars together and you have it. But since I don't have the expierence in javascript I won't be able to implement this.

Yeah logic isn't an issue here. we can of course get the data and manipulate it as per our needs.

BUT! The issue is that vercel serverless execution time is only 10sec and it's not enough to fetch all those data & then manipulate it, serverless function would time out long before we even get to fetching all org data.

and then get all each repo from each org

And this is also very expensive because the organization can have many repos and we have to fetch all of them and accumulate the star count.

from github-readme-stats.

dzikoysk avatar dzikoysk commented on May 17, 2024

@anuraghazra some kind of lightweight cache could be a solution 🤔

from github-readme-stats.

ngoldack avatar ngoldack commented on May 17, 2024

@anuraghazra or concurrency.

Another problem would be the rate limiting with too much orgs/repos

from github-readme-stats.

anuraghazra avatar anuraghazra commented on May 17, 2024

some kind of lightweight cache could be a solution thinking

We already have caching, it's not the issue since the initial data wont even load because vercel would timeout.

from github-readme-stats.

zhangyuang avatar zhangyuang commented on May 17, 2024

the same demands

from github-readme-stats.

franky47 avatar franky47 commented on May 17, 2024

The GitHub REST API has an endpoint to list repositories where the authenticated user is either the owner or a member, this would make most sense for this kind of stats: if I've pushed a README update to facebook/react, its stars should not be credited to my account, but it should if I'm a core member/maintainer.

There are some drawbacks though:

  • It's REST, I'm not sure if there's an equivalent in GraphQL (will have to dig it out)
  • It's limited to 100 repositories per page, so fetching them all could take a while and bust the 10s Vercel timeout for highly productive users 😅

Having an explicit list of orgs would be a nice API but could expose the same "cheating" behaviour: just list a few famous orgs and you're an instant 10x developer! 😅

from github-readme-stats.

developStorm avatar developStorm commented on May 17, 2024

@franky47 * It's REST, I'm not sure if there's an equivalent in GraphQL (will have to dig it out)

Does this GraphQL query look like the same thing you're talking about?
https://github.community/t/graphql-api-how-to-fetch-all-repositories-that-the-current-user-has-access-to/13792/10

from github-readme-stats.

franky47 avatar franky47 commented on May 17, 2024

Same here: the Eagle code in my demo card was probably 10+ years old example repositories with lots of hardware/PCB files that I wouldn't want shown in my stats, which brings us to filtering again.

from github-readme-stats.

anuraghazra avatar anuraghazra commented on May 17, 2024

@rickstaa agreed.

I'm fine with adding this ownerAffiliations feature to the stats if majority of people thinks it's a useful feature and can provide them with much better stat results.

Even though I'm still ridgid to my #1 (comment)

I also somewhat agree with @developStorm's thoughts that it's "not necessary to overthink anti-cheating as an open source stats project"

from github-readme-stats.

GMkonan avatar GMkonan commented on May 17, 2024

This issue covers only stars stats right? From what I've read and tested it seems like it. If this is correct, do you guys plan on making other stats such as PR and commits in organizations count as well? Sorry if I misunderstood something and thank you guys for everything.

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024

@anuraghazra I added the #1450 to allow people to make their star count more representative when #1122 has been merged. I, for example, am a contributor to some popular repositories for which, based on the number of commits, I don't feel like I deserve the stars. Below is just an example since I could have removed the ORGANIZATION_MEMBER tag but adding the exclude_repo option to the stats card would allow me to exclude specific repositories.

We can of course also look for a middle ground and allow the ORGANIZATION_MEMBER option for the language card but filter it out in the stats card.

My stats with reviewdog

Rick's Github stats

My stats without reviewdog

Rick's Github stats

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024

@developStorm Don't users also receive the stars and languages results when they add their user accounts as collaborators of the repositories in the organizations they created (see https://docs.github.com/en/graphql/reference/enums#repositoryaffiliation)? In that case, I have to agree with @anuraghazra #1 (comment) that we should filter out the ORGANIZATION_MEMBER value for both the language and stats card.

Verify

Let's quickly test the assumption above by creating a new organization (i.e. https://github.com/orgs/github-readme-stats-issue-1-test), creating (i.e. a new repository github-readme-stats-issue-1-test, adding myself as a member and giving it 2 stars. I received the 2 stars from the organization repository, although I did not commit to it. You can see this behaviour in action the GraphqExplorer by using the following syntax:

query userInfo($login: String!, $ownerAffiliations: [RepositoryAffiliation]) {
  user(login: $login) {
    repositories(first: 100, ownerAffiliations: $ownerAffiliations, orderBy: {direction: DESC, field: STARGAZERS}) {
      totalCount
      nodes {
        name
        stargazers {
          totalCount
        }
      }
    }
  }
}

while using variables:

{"login": "rickstaa", "ownerAffiliations": ["COLLABORATOR"]}

from github-readme-stats.

guillaumearnx avatar guillaumearnx commented on May 17, 2024

Hello,

I've deployed my own Vercel Instance but I'm not able to fetch languages in organizations like with https://github-readme-stats-one-bice.vercel.app instance.
I suppose that it's a fork with more features but I'm not able to find the source code. Please can someone help me ?

Thank's

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024

@guillaumearnx To use the organization feature you have to merge #1122 into one of your branches. If you set up your own Vercel instance according to the documentation you should then be able to use the organization feature using the link provided by vercel.

Feel free to temporary use my Vercel instance until this feature request has been merged. The link for this instance can be found in my personal README.

from github-readme-stats.

guillaumearnx avatar guillaumearnx commented on May 17, 2024

Thank's @rickstaa. If i want to wetch my private repos, do i need to run my own instance with your fork ?
Because I can't see my private repos with your instance

from github-readme-stats.

guillaumearnx avatar guillaumearnx commented on May 17, 2024

thank's a lot

from github-readme-stats.

KendallDoesCoding avatar KendallDoesCoding commented on May 17, 2024

Is this coming soon?

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024

@developStorm Don't users also receive the stars and languages results when they add their user accounts as collaborators of the repositories in the organizations they created (see https://docs.github.com/en/graphql/reference/enums#repositoryaffiliation)? In that case, I have to agree with @anuraghazra #1 (comment) that we should filter out the ORGANIZATION_MEMBER value for both the language and stats card.

Verify

Let's quickly test the assumption above by creating a new organization (i.e. https://github.com/orgs/github-readme-stats-issue-1-test), creating (i.e. a new repository github-readme-stats-issue-1-test, adding myself as a member and giving it 2 stars. I received the 2 stars from the organization repository, although I did not commit to it. You can see this behaviour in action the GraphqExplorer by using the following syntax:

query userInfo($login: String!, $ownerAffiliations: [RepositoryAffiliation]) {
  user(login: $login) {
    repositories(first: 100, ownerAffiliations: $ownerAffiliations, orderBy: {direction: DESC, field: STARGAZERS}) {
      totalCount
      nodes {
        name
        stargazers {
          totalCount
        }
      }
    }
  }
}

while using variables:

{"login": "rickstaa", "ownerAffiliations": ["COLLABORATOR"]}

@developStorm Friendly, ping to see if you have seen my previous comment. 😄

from github-readme-stats.

developStorm avatar developStorm commented on May 17, 2024

@rickstaa Hi Rick, I appreciate your efforts on this issue! I did see your comment earlier, but I don't see a problem with giving users this freedom of choice. They are the ones who are ultimately responsible for their own user homepage. Since we don't have it as a default, I think we should be okay.

But then again, after I joined multiple organizations myself, this did get a bit cumbersome to manage. Plus the owners of this stat card project have been very inactive about this long-standing issue (it's been over 150 days since they last promised to review #1122 "this weekend" 😅), I'm a little disheartened about this now. Personally, I would probably choose to migrate to some other GitHub Action-based project to get a greater degree of customizability and longer computation times. If runtime is not an issue, it is well possible to calculate user contributions in a more accurate way (e.g. cloning all repositories and scanning language distribution in commits actual made by the user).

from github-readme-stats.

joaovian06 avatar joaovian06 commented on May 17, 2024

any update in this issue?

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024

@developStorm Thanks a lot for your answer. The PR you created is valuable and should be merged into the repository (it is the most requested feature). As of lately, I have been added as a collaborator to help @anuraghazra deal with the popularity of this repository. I am happy to review your PR and merge it. However, since it is a significant change, I first want to agree on including the ORGANIZATION_MEMBER option. Let's, therefore, wait for @anuraghazra to state his thoughts about this.

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024

I would probably choose to migrate to some other GitHub Action-based project to get a greater degree of customizability and longer computation times. If runtime is not an issue, it is well possible to calculate user contributions more accurately (e.g. cloning all repositories and scanning language distribution in commits actual made by the user).

@developStorm, I see. I, however, am not sure how this method is possible in a cost-effective way. I think using the Github graphql API is just as accurate.

The main concern some people have is with how the stars are calculated. I agree that it would be better to include all the contributions to public, private and organization repositories. For organizations, you could then divide the code changes a person made by the total code in the repository and multiply the stars by that number. This, however, favours people that write lengthy (bad) code. 😅 It also neglects all the other things people can do to contribute to an open-source project, like code reviews and answering issues and discussions.

I, therefore, think the version you implemented in #1122, with the ORGANIZATION_MEMBER option filtered out, serves as an excellent middle ground. If people want to create a false star count, we cannot stop them anyway. 🥲

from github-readme-stats.

developStorm avatar developStorm commented on May 17, 2024

This, however, favours people that write lengthy (bad) code. 😅 It also neglects all the other things people can do to contribute to an open-source project, like code reviews and answering issues and discussions.

@rickstaa This is true. If you want to achieve absolutely fair distribution, we need to provide a platform for all organization administrators to register and submit the actual workload of their members. Overall, automating the assessment of workload sounds impossible to me. So since you can't do it accurately anyway, you might as well let the users do the job themselves. If a person's home page shows 100,000 stars stats card but no pinned repo shows their contribution to those stars, other people are not fools.

from github-readme-stats.

nyxb avatar nyxb commented on May 17, 2024

5. git add remote develop [email protected]:developStorm/github-readme-stats.git

@rickstaa
fatal: pathspec 'remote' did not match any files <--@phpstorm

from github-readme-stats.

mendax1234 avatar mendax1234 commented on May 17, 2024

When will stats for an organization be supported? If so, how to use it?

from github-readme-stats.

RuiGuilherme avatar RuiGuilherme commented on May 17, 2024

@rickstaa I just tested your deployment on Vercel with support for organizations, I believe that the "Top Language" is not working correctly. The main languages of the repositories are in Java and that's more than 500 commits and I didn't have any changes in the "Top Language".

Are there any limitations at the moment to check the languages of private organizations?

from github-readme-stats.

RuiGuilherme avatar RuiGuilherme commented on May 17, 2024

@RuiGuilherme If you followed these steps for deploying your own private instance and added a PAT that has access to the repositories of these private organizations, it should work. The permissions are the same as in the GraphQL Explorer when you're logged in (see #1770 (comment)).

It worked perfectly, thank you very much for the quick response.

from github-readme-stats.

VianaSamuel avatar VianaSamuel commented on May 17, 2024

@guillaumearnx In that case, you need to create your own instance since a Personal Access Token needs to be present in the instance. I am happy to help if you run into problems. The following steps should get it working for you:

  1. Fork the https://github.com/anuraghazra/github-readme-stats repository.
  2. Follow the Vercel instance documentation to set up your own Vercel instance.
  3. Clone your fork to your PC git clone <FORK_SSH_URL>.
  4. Create a new branch git checkout -b org-stats.
  5. Add @developStorm remote to your remotes git remote add develop [email protected]:developStorm/github-readme-stats.git.
  6. Fetch the remote git fetch develop
  7. Merge @developStorm changes into your branch git merge develop/master.
  8. Push these changes to your remote git push.
  9. On Vercel you will see that an instance has been deployed for the org-stats branch.
  10. You can use the link that is shown for that deployment to create your cards.

So, I'm kinda a newbie on git and I was trying to follow your tutorial.
Everything went fine until the 8th step (git push).

That's what I got when I tried to do that in the terminal:

fatal: The current branch org-stats has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin org-stats

To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.

So I tried the git push --set-upstream origin org-stats and everything (apparently) went fine, the Vercel deployed again, but my stats cards was still the same.

If possible, could you give me some help? And apologies in advance for the bothering, I'm completely layman with git.

from github-readme-stats.

brunolnetto avatar brunolnetto commented on May 17, 2024

I followed the instructions available on the post, as you can see by commits and action approval on post. I had to additionally:

  1. fix conflicts with master branch;
  2. Run command npm run install && npm run prepare && npm run run prettier && npm run run prettier:check to assure the local environment was similar to this library's author.

After auto-deploy my own vercel app and substitution on original repository, it rendered the image below. What did I wrong? :-(

image

from github-readme-stats.

ningding97 avatar ningding97 commented on May 17, 2024

@guillaumearnx In that case, you need to create your own instance since a Personal Access Token needs to be present in the instance. I am happy to help if you run into problems. The following steps should get it working for you:

  1. Fork the https://github.com/anuraghazra/github-readme-stats repository.
  2. Follow the Vercel instance documentation to set up your own Vercel instance.
  3. Clone your fork to your PC git clone <FORK_SSH_URL>.
  4. Create a new branch git checkout -b org-stats.
  5. Add @developStorm remote to your remotes git remote add develop [email protected]:developStorm/github-readme-stats.git.
  6. Fetch the remote git fetch develop
  7. Merge @developStorm changes into your branch git merge develop/master.
  8. Push these changes to your remote git push.
  9. On Vercel you will see that an instance has been deployed for the org-stats branch.
  10. You can use the link that is shown for that deployment to create your cards.

Hi, like many other developers, I maintain open-source projects in an organization but not a personal account. After strictly following the instructions, I find that the number of total stars is still not changed (while the number of total commits increases). I'm not an expert on js, so could you please summarize the current criterion here? For example, if I am a member of an organization, and I have created, admined, and maintained some projects, will the stars of these projects be counted? Thx!

from github-readme-stats.

LucBerge avatar LucBerge commented on May 17, 2024

Hello,
Most of my personnal work has been moved to organizations as well. I'm also really interested about this feature !

from github-readme-stats.

brunolnetto avatar brunolnetto commented on May 17, 2024

@LucBerge I failed to reproduce the same as @rickstaa did. So, I used his vercel deployed app :-P. You can use my README content and replace property username right-hand side by yours.

from github-readme-stats.

brunolnetto avatar brunolnetto commented on May 17, 2024

I think the language count in "Jupyter Notebook" is overrated: look at my profile! This language bar is much bigger than others, which makes me think it counts code rows instead of files. However, since this programming language uses cells to do its stuff, most file rows are rendered and style definitions.

from github-readme-stats.

wleoncio avatar wleoncio commented on May 17, 2024

IIRC the stats already count lines of code, not files. The issue is that behind the simplest Jupyter Notebook is hundreds, maybe thousands of lines of JSON code. For example, I just started and saved an empty ipynb file. This is what I see when I open that same file on vim:

{
  "cells": [
   {
    "cell_type": "code",
    "execution_count": null,
    "metadata": {},
    "outputs": [],
    "source": []
   }
  ],
  "metadata": {
   "language_info": {
    "name": "python"
   },
   "orig_nbformat": 4
  },
  "nbformat": 4,
  "nbformat_minor": 2
}

That's 19 lines of code for a file containing nothing but an empty cell, so it's no wonder having a couple of Jupyter Notebooks would be enough for it to dominate someone's stats. Until that gets fixed to reflect actual human-written code, you might want to configure your stats to ignore the language.

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024

@wleoncio Thanks for the detailed explanation. @brunolnetto, you can use the hide parameter (i.e. &hide=jupyter%20notebook) to remove the jupyter notebook results. See https://github.com/anuraghazra/github-readme-stats#hiding-individual-stats for more information.

from github-readme-stats.

Ran-Xing avatar Ran-Xing commented on May 17, 2024

+1+1

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024

As of today, people can also use the https://github.com/anuraghazra/github-readme-stats/tree/master_orgs branch in their own Vercel deployments to include organization stats.

Warning
Please remember that this is an unreleased feature (see #2277), so things can still break. Further, please be aware that because of #1852, only the first 100 repositories are used. Including organization, stats might therefore skew your results.

from github-readme-stats.

brunolnetto avatar brunolnetto commented on May 17, 2024

Great! 😱

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024

Great! scream

No problem. As stated in #1 (comment) I can not give any guarantees that the syntax stays the same since #2277 is still under review. It would be best if you used the master_orgs branch of your own Vercel deployment.

from github-readme-stats.

Ran-Xing avatar Ran-Xing commented on May 17, 2024

请尽快安排,我超喜欢,真的牛逼

Please arrange it as soon as possible. I like it very much. NIU BI

from github-readme-stats.

brunolnetto avatar brunolnetto commented on May 17, 2024

@rickstaa I copy-pasted your readme. It means, as soon as you do not update your vercel app instance, I am good. However, since it seems you are the most active collaborator to this project, I must somewhen in the future consider to build my own instance.

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024

@rickstaa I copy-pasted your readme. It means, as soon as you do not update your vercel app instance, I am good. However, since it seems you are the most active collaborator to this project, I must somewhen in the future consider to build my own instance.

No worries I'm not gonna change the syntax of the master_rstaa branch until #2277 is merged. Otherwise, I will let you know. 👍🏻

from github-readme-stats.

brunolnetto avatar brunolnetto commented on May 17, 2024

I earned an A++. I am feeling lovely

from github-readme-stats.

rickstaa avatar rickstaa commented on May 17, 2024

@brunolnetto I think it is best for now that you switch to https://github-readme-stats-git-masterorgs-github-readme-stats-team.vercel.app since I'm not updating the master-rstaa branch anymore and I might remove it in the future. I'm now using my master_rstaa branch.

from github-readme-stats.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.