Skip to content

Commit

Permalink
Fork count
Browse files Browse the repository at this point in the history
Signed-off-by: AbstractionFactory <[email protected]>
  • Loading branch information
abstractionfactory committed Sep 10, 2024
1 parent 41915c7 commit 6c45ad4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions vcs/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,6 @@ type RepositoryInfo struct {
// ForkOf indicates that this repository is a fork or copy of another repository. This is empty if the
// repository is not a known fork/copy.
ForkOf *RepositoryAddr `json:"fork_of,omitempty"`
// ForkCount exposes the amount of copies/forks present in the VCS.
ForkCount int
}
2 changes: 2 additions & 0 deletions vcs/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ func (g github) GetRepositoryInfo(ctx context.Context, repository vcs.Repository
type repoInfoResponse struct {
Description string `json:"description"`
StargazersCount int `json:"stargazers_count"`
ForkCount int `json:"forks_count"`
Parent *struct {
Name string `json:"name"`
Owner struct {
Expand All @@ -126,6 +127,7 @@ func (g github) GetRepositoryInfo(ctx context.Context, repository vcs.Repository
repoInfo := vcs.RepositoryInfo{
Description: response.Description,
Popularity: response.StargazersCount,
ForkCount: response.ForkCount,
}
if response.Parent != nil {
repoInfo.ForkOf = &vcs.RepositoryAddr{
Expand Down

0 comments on commit 6c45ad4

Please sign in to comment.