diff --git a/src/Commands/NuGetStatsCommand.cs b/src/Commands/NuGetStatsCommand.cs
index de002ff..20b85f4 100644
--- a/src/Commands/NuGetStatsCommand.cs
+++ b/src/Commands/NuGetStatsCommand.cs
@@ -12,6 +12,7 @@
using NuGet.Packaging;
using NuGet.Packaging.Core;
using NuGet.Protocol.Core.Types;
+using NuGet.Protocol.Providers;
using NuGet.Versioning;
using Polly;
using Spectre.Console;
@@ -386,10 +387,15 @@ await Parallel.ForEachAsync(tasks, paralell, async (source, cancellation) =>
if (ownerRepo != null)
{
+ // Account for repo renames/ownership transfers
+ if (await graph.QueryAsync(GraphQueries.RepositoryFullName(ownerRepo)) is { } fullName)
+ ownerRepo = fullName;
+
// Check contributors only once per repo, since multiple packages can come out of the same repository
if (!model.Repositories.ContainsKey(ownerRepo))
{
var contribs = await graph.QueryAsync(GraphQueries.RepositoryContributors(ownerRepo));
+
if (contribs?.Length == 0)
{
// Make sure we haven't exhausted the GH API rate limit
diff --git a/src/Core/GraphQueries.cs b/src/Core/GraphQueries.cs
index 94b6d27..9b9c842 100644
--- a/src/Core/GraphQueries.cs
+++ b/src/Core/GraphQueries.cs
@@ -886,6 +886,14 @@ ... on Organization {
}
};
+ ///
+ /// Gets the current full name of the specified owner/repo (might have been renamed and/or moved to another owner).
+ ///
+ public static GraphQuery RepositoryFullName(string ownerRepo) => new($"/repos/{ownerRepo}", ".full_name")
+ {
+ IsLegacy = true,
+ };
+
///
/// Gets rate limit information.
///