anuraghazra / github-readme-stats

:zap: Dynamically generated stats for your github readmes
https://github-readme-stats.vercel.app
MIT License
70.01k stars 23.27k forks source link

[IMPROVEMENT] - Adding Organizations-related stars to the owner profile #2325

Closed D3vil0p3r closed 1 year ago

D3vil0p3r commented 1 year ago

Is your feature request related to a problem? Please describe.

Currently, github-readme-stats leverages shows only stars related to profile's repositories. In case I created an organization that is collecting a good amount of stars, it is not shown in my github-readme-stats profile stats, and it could be very useful for having it.

For example in my case I have on my user repositories a total of 25 stars. My new organization profile I created for a project is counting 271 stars. I would like that these 271 stars are summed to my 25 stars.

Describe the solution you'd like

Sum of user repositories stars + user's organization repositories stars

Describe alternatives you've considered

No response

Additional context

No response

rickstaa commented 1 year ago

@D3vil0p3r Thanks for your feature request. This is one of our most requested features (see #1935). It has already been implemented in #2277 but still needs tests. You can, however, already use it (see https://github.com/anuraghazra/github-readme-stats/issues/1#issuecomment-1329809068).

D3vil0p3r commented 1 year ago

@D3vil0p3r Thanks for your feature request. This is one of our most requested features (see #1935). It has already been implemented in #2277 but still needs tests. You can, however, already use it (see #1 (comment)).

I tested it by using the query you provided in GitHub Explorer and it works with my username, it can see also my organization stars. What I don't know is how I can produce that graphical statement by starting with the new query in https://github.com/anuraghazra/github-readme-stats/issues/1#issuecomment-1329809068

rickstaa commented 1 year ago

@D3vil0p3r Thanks for your feature request. This is one of our most requested features (see #1935). It has already been implemented in #2277 but still needs tests. You can, however, already use it (see #1 (comment)).

I tested it by using the query you provided in GitHub Explorer and it works with my username, it can see also my organization stars. What I don't know is how I can produce that graphical statement by starting with the new query in #1 (comment)

@D3vil0p3r Ah, I just noticed that I gave you the wrong comment. An explanation of how to use it can be found at https://github.com/anuraghazra/github-readme-stats/issues/1#issuecomment-1321896111.

D3vil0p3r commented 1 year ago

Thank you @rickstaa I dont know why but for my username it does not show the organization stars... If I visit https://github-readme-stats-git-masterorgs-github-readme-stats-team.vercel.app/api?username=D3vil0p3r&include_orgs=true it does not retrieve organization stars... I'm the creator and the owner of the following organization: https://github.com/Athena-OS

This behavior is weird because in GitHub explorer, if I run the following queries:

query userInfo($login: String!) {
  user(login: $login) {
    name
    login
    repositories(
      first: 100
      ownerAffiliations: [OWNER, COLLABORATOR, ORGANIZATION_MEMBER]
      orderBy: {direction: DESC, field: STARGAZERS}
    ) {
      nodes {
        name
        stargazers {
          totalCount
        }
      }
      pageInfo {
        hasNextPage
        endCursor
      }
    }
  }
}
{
  "login": "D3vil0p3r"
}

I get also my organization:

{
  "data": {
    "user": {
      "name": "D3vil0p3r",
      "login": "D3vil0p3r",
      "repositories": {
        "nodes": [
          {
            "name": "athena-iso",
            "stargazers": {
              "totalCount": 290
            }
          },
          {
            "name": "catana",
            "stargazers": {
              "totalCount": 10
            }
          },
          {
            "name": "hackontext",
            "stargazers": {
              "totalCount": 7
            }
          },
          {
            "name": "HackTheBox-API",
            "stargazers": {
              "totalCount": 3
            }
          },
          {
            "name": "athena-repository",
            "stargazers": {
              "totalCount": 3
            }
          },
          {
            "name": "cookey",
            "stargazers": {
              "totalCount": 3
            }
          },
          {
            "name": "D3vil0p3r",
            "stargazers": {
              "totalCount": 2
            }
          },
          {
            "name": "OSCP-Exam-Report-Template-Markdown",
            "stargazers": {
              "totalCount": 1
            }
          },
          {
            "name": "comMENTOR",
            "stargazers": {
              "totalCount": 1
            }
          },
          {
            "name": "timeverter",
            "stargazers": {
              "totalCount": 1
            }
          },
          {
            "name": "chatgpt-desktop",
            "stargazers": {
              "totalCount": 0
            }
          },
          {
            "name": "BlackArch-Guide",
            "stargazers": {
              "totalCount": 0
            }
          },
          {
            "name": "blackarch",
            "stargazers": {
              "totalCount": 0
            }
          },
          {
            "name": "Aether",
            "stargazers": {
              "totalCount": 0
            }
          },
          {
            "name": "awesome-github-profile-readme",
            "stargazers": {
              "totalCount": 0
            }
          },
          {
            "name": "TryHackMe",
            "stargazers": {
              "totalCount": 0
            }
          },
          {
            "name": "awesome-cybersecurity-blueteam",
            "stargazers": {
              "totalCount": 0
            }
          },
          {
            "name": "HackTheBox",
            "stargazers": {
              "totalCount": 0
            }
          }
        ],
        "pageInfo": {
          "hasNextPage": false,
          "endCursor": "Y3Vyc29yOnYyOpIAzhbMibg="
        }
      }
    }
  }
}
rickstaa commented 1 year ago

Thank you @rickstaa I dont know why but for my username it does not show the organization stars... If I visit https://github-readme-stats-git-masterorgs-github-readme-stats-team.vercel.app/api?username=D3vil0p3r&include_orgs=true it does not retrieve organization stars... I'm the creator and the owner of the following organization: https://github.com/Athena-OS

This behavior is weird because in GitHub explorer, if I run the following queries:

query userInfo($login: String!) {
  user(login: $login) {
    name
    login
    repositories(
      first: 100
      ownerAffiliations: [OWNER, COLLABORATOR, ORGANIZATION_MEMBER]
      orderBy: {direction: DESC, field: STARGAZERS}
    ) {
      nodes {
        name
        stargazers {
          totalCount
        }
      }
      pageInfo {
        hasNextPage
        endCursor
      }
    }
  }
}
{
  "login": "D3vil0p3r"
}

I get also my organization:

{
  "data": {
    "user": {
      "name": "D3vil0p3r",
      "login": "D3vil0p3r",
      "repositories": {
        "nodes": [
          {
            "name": "athena-iso",
            "stargazers": {
              "totalCount": 290
            }
          },
          {
            "name": "catana",
            "stargazers": {
              "totalCount": 10
            }
          },
          {
            "name": "hackontext",
            "stargazers": {
              "totalCount": 7
            }
          },
          {
            "name": "HackTheBox-API",
            "stargazers": {
              "totalCount": 3
            }
          },
          {
            "name": "athena-repository",
            "stargazers": {
              "totalCount": 3
            }
          },
          {
            "name": "cookey",
            "stargazers": {
              "totalCount": 3
            }
          },
          {
            "name": "D3vil0p3r",
            "stargazers": {
              "totalCount": 2
            }
          },
          {
            "name": "OSCP-Exam-Report-Template-Markdown",
            "stargazers": {
              "totalCount": 1
            }
          },
          {
            "name": "comMENTOR",
            "stargazers": {
              "totalCount": 1
            }
          },
          {
            "name": "timeverter",
            "stargazers": {
              "totalCount": 1
            }
          },
          {
            "name": "chatgpt-desktop",
            "stargazers": {
              "totalCount": 0
            }
          },
          {
            "name": "BlackArch-Guide",
            "stargazers": {
              "totalCount": 0
            }
          },
          {
            "name": "blackarch",
            "stargazers": {
              "totalCount": 0
            }
          },
          {
            "name": "Aether",
            "stargazers": {
              "totalCount": 0
            }
          },
          {
            "name": "awesome-github-profile-readme",
            "stargazers": {
              "totalCount": 0
            }
          },
          {
            "name": "TryHackMe",
            "stargazers": {
              "totalCount": 0
            }
          },
          {
            "name": "awesome-cybersecurity-blueteam",
            "stargazers": {
              "totalCount": 0
            }
          },
          {
            "name": "HackTheBox",
            "stargazers": {
              "totalCount": 0
            }
          }
        ],
        "pageInfo": {
          "hasNextPage": false,
          "endCursor": "Y3Vyc29yOnYyOpIAzhbMibg="
        }
      }
    }
  }
}

@D3vil0p3r I think that is because I, for now, removed the ORGANIZATION_MEMBER (see https://github.com/anuraghazra/github-readme-stats/issues/1#issuecomment-1345199311) in #2277.

https://github.com/anuraghazra/github-readme-stats/blob/06aee4f12c1f8675d961405d78e841cad40a25ef/src/fetchers/stats-fetcher.js#L153-L158

I created #2277 because @anuraghazra didn't like that stats would show up for repositories to which users did not contribute but were simply a member (see https://github.com/anuraghazra/github-readme-stats/issues/1#issuecomment-864451245). In the end, however, it doesn't matter since if people want to cheat, they will always find a way to do so. So, I'm also okay with #1122.

The biggest problem is that we can currently only fetch the first 100 repositories due to timeout and GraphQL limits (see https://github.com/anuraghazra/github-readme-stats/issues/1852). The organization feature will, therefore, likely only be available in the GitHub Action version of GRS (see #2179). I am planning to release this action later this year.