Skip to content

Bug: Forked repository stats are sourced from the user's fork instead of the upstream parent repository #155

@saishmungase

Description

@saishmungase

Bug Report

Description

The current implementation for fetching repository data incorrectly sources statistics (like stars, forks, and contributors) from a user's personal fork rather than the original upstream repository they contributed to.

This leads to a significant misrepresentation of a user's open-source contributions. For example, if a user forks and contributes to a project with 10k+ stars, the script currently reports the stats of their personal fork, which might have 0 stars and only 1 contributor (the user themselves).

Current Behavior

  1. The fetch_all_github_repos function iterates through a user's repositories.
  2. For a forked project, it takes stats like stargazers_count and forks_count directly from the fork's data object.
  3. It calls fetch_repo_contributors(username, repo_name), using the user's own username as the owner, thus fetching contributors from the fork, not the parent.
    Image

The Part Where Issue is =>

Image

Expected Behavior

For forked repositories, the script should fetch and display the stats and contributors from the original parent repository to accurately reflect the impact and context of the user's contributions.

Proposed Solution

The logic in the fetch_all_github_repos function needs to be updated. When a repository is identified as a fork, the script should:

  1. Use the repo['parent'] object as the primary source for details like stargazers_count, forks_count, description, etc.
  2. Extract the owner and repo_name from the parent's full_name (repo['parent']['full_name']).
  3. Use this parent owner and repo name when calling fetch_repo_contributors to get the correct list of contributors from the upstream project.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions