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

[Feature Request] Add organization stats #1

Open
franky47 opened this issue Jul 9, 2020 · 153 comments · May be fixed by #1122
Open

[Feature Request] Add organization stats #1

franky47 opened this issue Jul 9, 2020 · 153 comments · May be fixed by #1122
Labels
enhancement New feature or request. ⭐ top feature Top feature request. ⭐ top issue Top issue. stats-card Feature, Enhancement, Fixes related to stats the stats card.

Comments

@franky47
Copy link

franky47 commented Jul 9, 2020

Most of my open-source work is moved to dedicated organizations (47ng, FortySevenEffects, Chiffre), for scoping and to avoid cluttering my personal repos.

I'd be happy to contribute a feature to include aggregated organization stats.

API ideas:

![Anurag's github stats](https://github-readme-stats.vercel.app/api?username=anuraghazra&orgs=acme,evilcorp,fsociety)
@anuraghazra
Copy link
Owner

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

@anuraghazra anuraghazra added the enhancement New feature or request. label Jul 10, 2020
@metaskills

This comment has been minimized.

@anuraghazra

This comment has been minimized.

@anuraghazra

This comment has been minimized.

@metaskills

This comment has been minimized.

@anuraghazra

This comment has been minimized.

@anuraghazra anuraghazra added feature and removed enhancement New feature or request. labels Jul 15, 2020
@FairyEver
Copy link

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

@deancn
Copy link

deancn commented Jul 24, 2020

my stars value is 0, can help check?

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

@terror
Copy link
Contributor

terror commented Jul 24, 2020

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.

@deancn
Copy link

deancn commented Jul 24, 2020

@terror got it, thanks.

@mainrs
Copy link

mainrs commented Jul 24, 2020

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

@daolou
Copy link

daolou commented Jul 29, 2020

How long this feature could be used?

@RubenMateus
Copy link

any news on this?

@ngoldack
Copy link

Any update on this?

@ngoldack
Copy link

ngoldack commented Sep 2, 2020

@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.

@daolou
Copy link

daolou commented Sep 2, 2020

@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

@mre
Copy link

mre commented Sep 2, 2020

@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. 🤔

@daolou
Copy link

daolou commented Sep 2, 2020

@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

@anuraghazra
Copy link
Owner

anuraghazra commented Sep 2, 2020

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.

@dzikoysk
Copy link

dzikoysk commented Sep 2, 2020

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

@ngoldack
Copy link

ngoldack commented Sep 2, 2020

@anuraghazra or concurrency.

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

@anuraghazra
Copy link
Owner

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.

@mpl1018
Copy link

mpl1018 commented Jul 14, 2023

We made this based on this issue: https://pullpo.io/products/devcard
Pullpo - DevCard

@joaovian06
Copy link

I tried this @mpl1018, but can´t get any values to my devcard. :(

@brunolnetto
Copy link

@mpl1018 I clicked the button "Create my DevCard" and others. It tries to log me in on Slack. It makes no sense to me.

@mpl1018
Copy link

mpl1018 commented Jul 17, 2023

I understand 😅 @joaovian06 @brunolnetto Pullpo started as a product to have code review conversations on ephemeral Slack channels per PR (https://pullpo.io/products/channels). However, we made the bad decision to use Slack for login instead of GitHub. This week, we are allowing users to log in with GitHub as well. I'll keep you updated!

@mpl1018
Copy link

mpl1018 commented Jul 21, 2023

UPDATE:
You should now be able to log in with GitHub and install Pullpo for your desired GitHub organization. Your devcard will be available at https://pullpo.io/app/profile. Sorry for the inconveniences 🙏

Don't worry if your stats appear as zeros; it can take some time to fetch historical data from the organization.

If you want to read about the permissions we ask for, you can check it out at https://docs.pullpo.io/github-permissions.
Additionally, here is a tutorial on how to set up the devcard: https://docs.pullpo.io/devcard-requirements.
Also feel free to reach out to me at [email protected]

@brunolnetto @erickskrauch @ketrab2004 @joaovian06 @kavanase

@rickstaa
Copy link
Collaborator

rickstaa commented Jul 21, 2023

UPDATE: You should now be able to log in with GitHub and install Pullpo for your desired GitHub organization. Your devcard will be available at https://pullpo.io/app/profile. Sorry for the inconveniences pray

Don't worry if your stats appear as zeros; it can take some time to fetch historical data from the organization.

If you want to read about the permissions we ask for, you can check it out at https://docs.pullpo.io/github-permissions. Additionally, here is a tutorial on how to set up the devcard: https://docs.pullpo.io/devcard-requirements. Also feel free to reach out to me at [email protected]

@brunolnetto @erickskrauch @ketrab2004 @joaovian06 @kavanase

@mpl1018, thanks for pointing me to your tool. More platforms to choose from for users is great 👍🏻. Another provider is https://quine.sh/. Having that said, people can already include organization stats in GRS by deploying their own instance and merging #2459. Furthermore, we will release a GitHub version of GRS after this summer that will give users the ability to get more accurate language and stats results, including organization stats (see #2179) 🚀.

@brunolnetto

This comment was marked as off-topic.

@rickstaa
Copy link
Collaborator

rickstaa commented Jul 21, 2023

Comment: @mpl1018 I would really like to know how you do such convolute software systems. Really! I am unemployed and feel very inadequate not knowing this.

Report : I got stuck on this "alert" pop-up component, which does not work (It may be something on its callback, I guess.)

image

I do not want to be a grinch here, but can we keep the pullpo bug reporting through the site intercom before it becomes a big thread 😅.

image

@brunolnetto
Copy link

This is all I hear: grinch, grinch, grinch.

@rickstaa
Copy link
Collaborator

This is all I hear: grinch, grinch, grinch.

🤣

grinch-coffee

@rickstaa
Copy link
Collaborator

@mpl1018 feel free to answer @francois-rozet's last question here. Just trying to prevent this from becoming a pullpo debug issue since a lot of people are subscribed 😅 .

@mpl1018
Copy link

mpl1018 commented Jul 24, 2023

Hi @francois-rozet! My apologies the inconvenience. The issue should be resolved now. 👍
Btw, to anyone interested, feel free to reach out to me at [email protected].

@francois-rozet
Copy link
Collaborator

Hey, no problem, but I don't even know why I'm mentioned here 😅 I guess it is a typo between my handle and the OP's handle.

@rickstaa
Copy link
Collaborator

Hey, no problem, but I don't even know why I'm mentioned here sweat_smile I guess it is a typo between my handle and the OP's handle.

Oh, sorry for the noise 😅. I should not try to answer GitHub issues quickly before shutting down at the end of the day. Should have been @brunolnetto indeed 👍🏻.

@brunolnetto
Copy link

I make this inconvenience sometimes, guys. Broad context makes me think in general answer anywwhere. Good job anyway.

step-security-bot pushed a commit to step-security-bot/github-readme-stats that referenced this issue Aug 9, 2023
@AsakusaRinne
Copy link

If a repository is created by me in a organization, and I'm a only a member instead of owner of this organization, it seems not to work. Anyone has an idea about it?

@qwerty541
Copy link
Collaborator

If a repository is created by me in a organization, and I'm a only a member instead of owner of this organization, it seems not to work. Anyone has an idea about it?

Hey, @AsakusaRinne! Do I understand correctly that you have deployed that branch #1122 on own instance, since if not this feature should not work because master branch does not contains that changes. In case if correct branch is deployed, the following values should be available to be passed into role querystring parameter: OWNER, COLLABORATOR, ORGANIZATION_MEMBER. I hope that one of them should work, also you are able to pass both this roles at once separating them with commas. If no role or combination of roles works, then this branch really needs fixing.

@AsakusaRinne
Copy link

If a repository is created by me in a organization, and I'm a only a member instead of owner of this organization, it seems not to work. Anyone has an idea about it?

Hey, @AsakusaRinne! Do I understand correctly that you have deployed that branch #1122 on own instance, since if not this feature should not work because master branch does not contains that changes. In case if correct branch is deployed, the following values should be available to be passed into role querystring parameter: OWNER, COLLABORATOR, ORGANIZATION_MEMBER. I hope that one of them should work, also you are able to pass both this roles at once separating them with commas. If no role or combination of roles works, then this branch really needs fixing.

Hi, sorry for the disturbing. I mistook the answers in this issue as the feature (role querystring parameter) has already supported by the current master branch. I've succeeded to get what I want today. Thank you so much!

@pplmx
Copy link

pplmx commented Sep 11, 2024

Any progress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request. ⭐ top feature Top feature request. ⭐ top issue Top issue. stats-card Feature, Enhancement, Fixes related to stats the stats card.
Projects
None yet
Development

Successfully merging a pull request may close this issue.