Skip to content

Improve RepoStats plugin resilience: graceful rate-limit handling in CI#798

Merged
valadas merged 3 commits into
mainfrom
copilot/improve-repostats-plugin-resilience
May 6, 2026
Merged

Improve RepoStats plugin resilience: graceful rate-limit handling in CI#798
valadas merged 3 commits into
mainfrom
copilot/improve-repostats-plugin-resilience

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 5, 2026

  • Fix GitHubApi.cs:
    • Make token field nullable (string?) — fixes pre-existing CS8618 compiler warning
    • ThrottleIfNeeded()Task<bool>: returns false when rate limit exhausted, progressive backoff when nearing
    • Try-catch for RateLimitExceededException and general exceptions in all API methods
    • Wrapped constructor rate-limit info check in try-catch
    • ACCESS_TOKEN env var support (PAT preferred over GithubToken/GITHUB_TOKEN)
    • Clear [RepoStats] prefixed log messages
  • Fix RepoStatsBuildStep.cs:
    • Extracted private PostbuildAsync method — all async calls use proper await; synchronous Postbuild interface method delegates to it via .GetAwaiter().GetResult() with explanatory comment
    • Outer try-catch for graceful fallback on API failure
    • Explicit List<Octokit.Contributor> type to avoid ambiguity

Copilot AI changed the title [WIP] Improve RepoStats plugin resilience against GitHub API rate limits Improve RepoStats plugin resilience: graceful rate-limit handling in CI May 5, 2026
Copilot finished work on behalf of valadas May 5, 2026 23:37
Copilot AI requested a review from valadas May 5, 2026 23:37
Console.WriteLine($"[RepoStats] Found {contributors.Count} contributors");

Console.WriteLine($"Found {commits.Count} commits");
commits = gitHubApi.GetCommitsAsync().GetAwaiter().GetResult().ToList();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not a fan of this sync usage of an async API, can we instead make the method async?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in e485750. IDocumentBuildStep.Postbuild is a void interface contract that DocFX calls synchronously, so we can't change its signature. The fix is a private PostbuildAsync method that uses proper await throughout — the public Postbuild now simply delegates to it with a single .GetAwaiter().GetResult() and an explanatory comment.

…ted GetAwaiter().GetResult()

Agent-Logs-Url: https://github.com/DNNCommunity/DNNDocs/sessions/3804f175-bf0e-4a12-9b8b-25f9187063a9

Co-authored-by: valadas <6371568+valadas@users.noreply.github.com>
Copilot finished work on behalf of valadas May 5, 2026 23:47
Copilot AI requested a review from valadas May 5, 2026 23:47
@valadas valadas marked this pull request as ready for review May 5, 2026 23:50
@valadas valadas merged commit 7f06294 into main May 6, 2026
2 checks passed
@valadas valadas deleted the copilot/improve-repostats-plugin-resilience branch May 6, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve RepoStats plugin resilience: Avoid GitHub API rate-limit failures in CI and support GITHUB_TOKEN gracefully

2 participants