Conversation
Replace git author name lookup with GitHub API-based login resolution. GetSuggestedReviewers collects commit SHAs for changed files (capped at 20), resolves each to a GitHub login via gh api, filters bots, and returns the top contributors by commit count. The PR body now shows @login mentions capped at 2 instead of 5 plain author names.
ReviewThe core idea is good — resolving to GitHub login handles for proper @-mentions is a real improvement over plain git author names. A few things to address: Promote
|
- Add GetSuggestedReviewers to the Provider interface so all platforms implement it; removes the *GitHubProvider type assertion in runner.go - Add GitLabProvider stub that returns nil (not implemented) - Add -n 20 to git log in GetSuggestedReviewers to avoid scanning full history on large repos - Remove dead GetFileContributors function (no longer called) - Normalize botNames lookup to lowercase to match the strings.ToLower check, fixing case inconsistency in bot filtering
|
LGTM — all feedback addressed:
|
Summary
Improve Toad's PR reviewer suggestions: enhance change detection logic, limit to 2 suggested reviewers, and tag GitHub accounts in PR description instead of plain text
Linear: PLF-3219
View Slack thread
Category: feature | Size: small
Suggested reviewers (based on recent file history): Hergen Dillema
Slack context
Improve PR reviewer suggestions: better change detection, cap at 2, tag GitHub accounts.
Files to change
internal/vcs/github.go—GetFileContributorsfunctioninternal/tadpole/runner.go— reviewer section buildingChanges
1.
internal/vcs/github.goRename or replace
GetFileContributors(ctx, repoPath, files, botSet, maxTotal)with a version that returns GitHub login handles instead of git author names.New approach:
git log --format=%H -- <files>(collect commit SHAs for changed files)GET /repos/{owner}/{repo}/commits/{sha}— the response includesauthor.login(the GitHub username). Use the existingGitHubProvider's authenticated client for these calls.maxTotallogins as[]string(each entry is just the login, e.g."johndoe").The
GitHubProviderstruct already has owner/repo info and a GitHub client — add a method on*GitHubProviderrather than a standalone function so it has access to the client. Something like:2.
internal/tadpole/runner.goIn the
shipfunction where reviewers are built:maxTotalargument from5to2vcsProvider.(*vcs.GitHubProvider).GetSuggestedReviewers(...)instead ofvcs.GetFileContributors(...)@prefix so GitHub renders them as mentions:"@" + loginreviewersSectionformat string to reflect this is tagging real accounts, e.g.:taggedis the slice with@prepended to each login.Notes
(truncated)
🐸 Created by toad tadpole