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

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

Closed
D3vil0p3r opened this issue Dec 12, 2022 · 5 comments
Closed
Labels
enhancement New feature or request.

Comments

@D3vil0p3r
Copy link

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

@D3vil0p3r D3vil0p3r added the enhancement New feature or request. label Dec 12, 2022
@rickstaa
Copy link
Collaborator

rickstaa commented Jan 3, 2023

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

@rickstaa rickstaa closed this as completed Jan 3, 2023
@D3vil0p3r
Copy link
Author

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

@rickstaa
Copy link
Collaborator

rickstaa commented Jan 3, 2023

@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 #1 (comment).

@D3vil0p3r
Copy link
Author

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
Copy link
Collaborator

rickstaa commented Jan 3, 2023

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 #1 (comment)) in #2277.

const variables = {
login: username,
first: 100,
after: endCursor,
ownerAffiliations: include_orgs ? ["OWNER", "COLLABORATOR"] : ["OWNER"],
};

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 #1 (comment)). 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 #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request.
Projects
None yet
Development

No branches or pull requests

2 participants