Repository navigation
Report packages whose source repo is archived or deleted (GitHub only) - #781
Open
HarnageaGabriel wants to merge 1 commit into
Open
HarnageaGabriel wants to merge 1 commit into
HarnageaGabriel wants to merge 1 commit into
Conversation
Packages can go stale silently when their source repo is archived or deleted, even while the NuGet listing itself is untouched — issue dotnet-outdated#181 already covers explicit deprecation metadata, but that leaves this gap uncovered. Scoped to GitHub only for now: other hosts (GitLab, Bitbucket, etc.) would need separate archived/deleted detection semantics and API clients, so this establishes the pattern for one host rather than guessing at the rest. Repository URL is read from the installed package's nuspec (reusing the local global-packages cache when available, falling back to a download only when necessary) so most lookups need no extra network round-trip. GitHub API failures, rate limiting, and non-GitHub URLs are all treated as "Unknown" and never fail the overall command. Fixes dotnet-outdated#200
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reports packages whose source-code repository has been archived or deleted, even when the package itself isn't marked deprecated on NuGet.
Complementary to #181 (deprecated packages) — that covers explicit deprecation metadata; this covers the case where a package's own repo has quietly gone away while the NuGet listing stays untouched.
Scope: GitHub only. Other hosts (GitLab, Bitbucket, etc.) would need their own archived/deleted-detection semantics and API clients — intentionally left out to keep this change focused; the
IRepositoryStatusServiceabstraction leaves room for additional providers later.How it works
NuGetPackageInfoService.GetRepositoryUrlreads the<repository>URL from the package's nuspec — first from the locally-restored global-packages cache (no extra network call for packages already restored), falling back to a metadata download only when not present locally. Falls back to the nuspec's project URL if no repository URL is set.GitHubRepositoryStatusServiceparsesowner/repoout ofgithub.comURLs (includinggit@github.com:SCP-style and.gitsuffixes) and checksGET api.github.com/repos/{owner}/{repo}: 404 →NotFound,archived: true→Archived, otherwiseActive. Results are cached per repo per run.Unknownrather than throwing — the overall command never fails because of this check. Requests use a 5s timeout.ArchivedorNotFound(kept quiet otherwise), plus new fields in the CSV, Markdown, and JSON output formats.Known limitation
The GitHub REST API is unauthenticated here (60 requests/hour per IP) — fine for typical project sizes, but large dependency trees run on the free plan may exhaust the quota, in which case remaining checks degrade to
Unknownrather than failing.Test plan
dotnet build— clean, no new warningsdotnet test— 217 passed, 0 failed (net8.0 and net9.0)GitHubRepositoryStatusServicecovering: archived, active, not-found, timeout, non-GitHub URL, network failuredotnet run -- test-projects/development-dependenciesFixes #200