github-profile-summary-cards icon indicating copy to clipboard operation
github-profile-summary-cards copied to clipboard

[Feature request] Support contributions in private organizations

Open wh1t3h47 opened this issue 3 years ago • 8 comments

Context I set up PAT and everything according to the wiki, GitHub actions runs successfully, but my contributions in private organizations are not counted. I am not sure if the same applies to private repositories in which I have access and contributed, but are owned by someone else. In my organization context, I did not create the project, but contributed heavily to it, even on projects that I created, profile summary seems to ignore them. I'd reproduce the behavior with a language that I never created a repo on (like Lua) and heavily code on it, as I'm not 100% sure if they are not being counted

Alternatives

I tried to set up PAT, but my stats did not seem to change

If the feature request is approved, would you be willing to submit a PR?

Yes, although I'm under a tight schedule and may delay it about a month

wh1t3h47 avatar Jul 28 '21 08:07 wh1t3h47

Hi @wh1t3h47, thanks for the issue. Can you point out which count is wrong, after that, I can figure out is this a bug or a feature we can add.

For example, we only count public repo for the number of repositories contributed to. https://github.com/vn7n24fzkq/github-profile-summary-cards/blob/a8a74c780d878380eb185f1144f8a992192d3fde/src/github-api/profile-details.js#L41

But there is no any filter for all contributions count https://github.com/vn7n24fzkq/github-profile-summary-cards/blob/a8a74c780d878380eb185f1144f8a992192d3fde/src/github-api/contributions-by-year.js#L17

vn7n24fzkq avatar Jul 29 '21 05:07 vn7n24fzkq

Hi! I'm @AkkyOrz First of all, thank you for an amazing product, @vn7n24fzkq.

I have a feature request similar to @wh1t3h47.

Can you point out which count is wrong.

"Total PRs" is the one that I recognize as giving different values than what I expect. (The other values can be wrong, but I haven't noticed it yet) I created a PR for a repository that belongs to my organization and merged it, but it is not counted up.

If you follow the example above, this is probably the case. https://github.com/vn7n24fzkq/github-profile-summary-cards/blob/a8a74c780d878380eb185f1144f8a992192d3fde/src/github-api/profile-details.js#L44-L46

(I don't know much about the GitHub GraphQL API, so I couldn't figure out how to reflect the repository information in the query.)

AkkyOrz avatar Sep 04 '21 09:09 AkkyOrz

@AkkyOrz Thanks for your report. The number of total PRs is from GitHub API v4, I am not sure why it is not counted up.

I guess maybe it is just not update yet, because of raw file cache or the card is not re-generate yet.

Can you try to use the GitHub GraphQL API Explorer to get the number of total PRs?

GraphQL

query UserDetails($login: String!) {
	user(login: $login) {
   	pullRequests(first: 1) {
    	totalCount
    }
  }
}

Query Variables

{"login":"AkkyOrz"}

It is should looks like this. And you need to change the login value in query variable to your username. image

vn7n24fzkq avatar Sep 04 '21 13:09 vn7n24fzkq

Thank you for your quick reply, @vn7n24fzkq !

I guess maybe it is just not update yet, because of raw file cache or the card is not re-generate yet.

Can you try to use the GitHub GraphQL API Explorer to get the number of total PRs?

Your example is very easy for me to understand how to use the GitHub GraphQL API. I tried it, and the value is different from my generated card.

I guess that my personal access token doesn't have enough privileges to make it work the way I expect it to. The GraphQL API Explorer asked me to grant the "Organization access" permissions.

Screenshot from 2021-09-06 14-40-49

Therefore, in order to reproduce the same behavior as the GitHub GraphQL API Explorer, we may need to allow Organization Access in some way. As far as I know, there are no examples that can be achieved with Personal Access Token. It may be difficult to make it work to include org's statics.

AkkyOrz avatar Sep 06 '21 05:09 AkkyOrz

Just to make sure, is the total PRs count from GitHub GraphQL API Explorer different to the generated card for you.

And is the number from GitHub GraphQL API Explorer you expect?

If that is true, as you said, it would be difficult to make it work to include org's stats, and I will investigate in depth.

vn7n24fzkq avatar Sep 06 '21 07:09 vn7n24fzkq

Just for make sure, is that total PRs count from GitHub GraphQL API Explorer different to the generated card for you.

Yes.

And is the number from GitHub GraphQL API Explorer you expect?

This is also correct. To add to this, when I granted "Organization access", the number of total PRs which was obtained through GitHub GraphQL API Explorer increased by the number of PRs issued by me in the organization.

If that is true, as you said, it would be difficult to make it work to include org's stats, and I will investigate in depth.

AkkyOrz avatar Sep 06 '21 08:09 AkkyOrz

@AkkyOrz Thanks for your report again, it is really helpful, other counts may have the same problem.

Maybe the problem @wh1t3h47 got was caused by the same reason.

I will investigate this in-depth in my free time, and look if there is any way can fix this problem.

vn7n24fzkq avatar Sep 06 '21 08:09 vn7n24fzkq

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.

stale[bot] avatar Dec 19 '21 21:12 stale[bot]