feat(github): implement Reviewer and Identity interfaces (#81) #105

Merged
aweiker merged 7 commits from review-bot-issue-81 into feature/github-support 2026-05-13 13:39:14 +00:00
2 changed files with 14 additions and 10 deletions
Showing only changes of commit cd8a1becb3 - Show all commits
+1
View File
15
@@ -173,6 +173,7 @@ func (c *Client) DeleteReview(ctx context.Context, owner, repo string, number in
reqURL := fmt.Sprintf("%s/repos/%s/%s/pulls/%d/reviews/%d",
c.baseURL, url.PathEscape(owner), url.PathEscape(repo), number, reviewID)
// nil body: the GitHub DELETE endpoint for reviews requires no request body.
_, err := c.doRequestWithBody(ctx, http.MethodDelete, reqURL, nil)
if err != nil {
var apiErr *APIError
2
+13 -10
View File
7
@@ -348,21 +348,24 @@ func TestDismissReview_401(t *testing.T) {
func TestTranslateGitHubReviewState(t *testing.T) {
tests := []struct {
name string
input string
want string
}{
Outdated
Review

[NIT] TestTranslateGitHubReviewState doesn't use t.Run for subtests, while the table iteration is fine for this trivial case, the project convention (and the Go patterns) favor t.Run with named subtests for table-driven tests to aid filtering and output. Minor inconsistency with the rest of the test style.

**[NIT]** TestTranslateGitHubReviewState doesn't use t.Run for subtests, while the table iteration is fine for this trivial case, the project convention (and the Go patterns) favor t.Run with named subtests for table-driven tests to aid filtering and output. Minor inconsistency with the rest of the test style.
{"APPROVED", "APPROVED"},
{"CHANGES_REQUESTED", "REQUEST_CHANGES"},
{"COMMENTED", "COMMENT"},
{"DISMISSED", "DISMISSED"},
{"UNKNOWN_STATE", "UNKNOWN_STATE"},
{"", ""},
{"approved passes through", "APPROVED", "APPROVED"},
{"changes_requested maps to REQUEST_CHANGES", "CHANGES_REQUESTED", "REQUEST_CHANGES"},
{"commented maps to COMMENT", "COMMENTED", "COMMENT"},
{"dismissed passes through", "DISMISSED", "DISMISSED"},
{"unknown state passes through", "UNKNOWN_STATE", "UNKNOWN_STATE"},
{"empty string passes through", "", ""},
Outdated
Review

[NIT] containsStr/containsSubstring reimplement substring search. Prefer using strings.Contains for clarity and to reduce helper code.

**[NIT]** containsStr/containsSubstring reimplement substring search. Prefer using strings.Contains for clarity and to reduce helper code.
}
for _, tt := range tests {
got := translateGitHubReviewState(tt.input)
if got != tt.want {
t.Errorf("translateGitHubReviewState(%q) = %q, want %q", tt.input, got, tt.want)
}
t.Run(tt.name, func(t *testing.T) {
got := translateGitHubReviewState(tt.input)
if got != tt.want {
t.Errorf("translateGitHubReviewState(%q) = %q, want %q", tt.input, got, tt.want)
}
})
}
}
2