Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit b1e6fe1

Browse files
committed
Increment counters NumberOfGitHub/EnterpriseClones
Record GitHub and GitHub Enterprise clones separately.
1 parent bc91249 commit b1e6fe1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/GitHub.App/Services/RepositoryCloneService.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,20 @@ public async Task CloneRepository(
121121
try
122122
{
123123
await vsGitServices.Clone(cloneUrl, repositoryPath, true, progress);
124+
124125
await usageTracker.IncrementCounter(x => x.NumberOfClones);
126+
127+
var repositoryUrl = new UriString(cloneUrl).ToRepositoryUrl();
128+
var isDotCom = HostAddress.IsGitHubDotComUri(repositoryUrl);
129+
if (isDotCom)
130+
{
131+
await usageTracker.IncrementCounter(x => x.NumberOfGitHubClones);
132+
}
133+
else
134+
{
135+
// If it isn't a GitHub URL, assume it's an Enterprise URL
136+
await usageTracker.IncrementCounter(x => x.NumberOfEnterpriseClones);
137+
}
125138
}
126139
catch (Exception ex)
127140
{

0 commit comments

Comments
 (0)