jstrieb / github-stats

Better GitHub statistics images for your profile, with stats from private repos too
GNU General Public License v3.0
2.95k stars 621 forks source link

Inaccurate stars by github copilot repo #53

Open qilip opened 3 years ago

qilip commented 3 years ago

Hi!

I found this repo a while ago and am trying it out. Most of it works fine 👍, but there was a problem with my Star count being excessively high. (EXCLUDE_FORKED_REPOS option is true)

capture

Referring to issue #18 , when I ran it locally, the copilot repo(github/copilot-preview) was included in the statistics.

I added this to EXCLUDED and it now looks fine. I haven't contributed to the copilot repo, but it seems to be included as part of a private repo. (maybe?🤔)

I'm not sure if it's a bug or not. However, I'm leaving this as an issue as there may be other users who may have the same problem.

Thanks for making a nice project!

jstrieb commented 3 years ago

Hey @qilip, thanks for taking the time to document this! Truthfully, I have no idea why this would be happening. But thanks for taking the time to research other issues before posting.

Out of curiosity, if you run the following query in the GitHub GraphQL API Explorer, does it show github/copilot-preview? If so, you can add and remove values from the contributionTypes list to figure out why it is there.

{
  viewer {
    login
    name
    repositories(first: 100) {
      nodes {
        nameWithOwner
      }
    }
    repositoriesContributedTo(
            first: 100,
            includeUserRepositories: false,
            contributionTypes: [
                COMMIT, 
                PULL_REQUEST, 
                REPOSITORY, 
                PULL_REQUEST_REVIEW
            ]
      ) {
      nodes {
        nameWithOwner
      }
    }
  }
}
qilip commented 3 years ago

When I ran that query, the github/copilot-preview repository only existed in repositories (first query).

In the case of , it seems to be visible only as a result of the first query, not in the second query.

  1. I'm not a owner
  2. No contribution in the past year
  3. I have access
  4. Other's private repo

I'm not sure if the above expression is correct. Below is a summary of the query results. (I did not change the contributionTypes because I can't see the github/copilot-preview repo in the second query even though I put all contributionTypes.)

{
  "data": {
    "viewer": {
      "login": "qilip",
      "name": "SangMin Shin",
      "repositories": {
        "nodes": [
          {
            "nameWithOwner": A // personal repos I own
          },
          {
            "nameWithOwner": B // other's private repo, have access but no contributions
          },
          {
            "nameWithOwner": C // other's private repo, have access and last contribution 2020.04.xx
          },
          {
            "nameWithOwner": D // other's private repo, have access and last contribution 2021.09.xx
          },
          {
            "nameWithOwner": E // other's private repo, have access and last contribution 2021.06.xx
          },
          {
            "nameWithOwner": "github/copilot-preview" // private, no contribution
          },
        ]
      },
      "repositoriesContributedTo": {
        "nodes": [
          {
            "nameWithOwner": F // organization repo (I'm one of owners) last contribution 2020.11.xx
          },
          {
            "nameWithOwner": D // other's private repo, have access and last contribution 2021.09.xx
          },
          {
            "nameWithOwner": E // other's private repo, have access and last contribution 2021.06.xx
          }
        ]
      }
    }
  }
}
jstrieb commented 3 years ago

Huh, that's quite unexpected. I guess maybe you were added to the repo somehow? I tend to doubt there is much I can do about this case, but I'll leave the issue open in case others have the same problem.

Thanks for documenting this and indulging my curiosity!

qilip commented 3 years ago

My guess is that the star of the private repo with the permissions is included.

However, most private repos don't have or have few stars, so this shouldn't be a problem. It seems that users who participated in the copilot preview may experience the same problem. (If you participate in the copilot preview, you get github/copilot-preview permission.)

Thank you for your help!