Skip to content

Commit e5dce1f

Browse files
committed
fix(github): remove PR options conversion, pass ListOptions directly to avoid nil panic
Signed-off-by: John Soutar <[email protected]>
1 parent 783b97d commit e5dce1f

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

pkg/services/github.go

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ type issuesService interface {
440440
}
441441

442442
type pullRequestsService interface {
443-
ListPullRequestsWithCommit(ctx context.Context, owner string, repo string, sha string, opts *github.PullRequestListOptions) ([]*github.PullRequest, *github.Response, error)
443+
ListPullRequestsWithCommit(ctx context.Context, owner string, repo string, sha string, opts *github.ListOptions) ([]*github.PullRequest, *github.Response, error)
444444
}
445445

446446
type repositoriesService interface {
@@ -464,7 +464,7 @@ func (g *githubClientAdapter) GetIssues() issuesService {
464464
}
465465

466466
func (g *githubClientAdapter) GetPullRequests() pullRequestsService {
467-
return &pullRequestsServiceAdapter{service: g.client.PullRequests}
467+
return g.client.PullRequests
468468
}
469469

470470
func (g *githubClientAdapter) GetRepositories() repositoriesService {
@@ -703,17 +703,3 @@ func (g gitHubService) Send(notification Notification, _ Destination) error {
703703

704704
return nil
705705
}
706-
707-
// PullRequestsServiceAdapter adapts GitHub's PullRequestsService to our interface
708-
type pullRequestsServiceAdapter struct {
709-
service *github.PullRequestsService
710-
}
711-
712-
func (a *pullRequestsServiceAdapter) ListPullRequestsWithCommit(ctx context.Context, owner string, repo string, sha string, opts *github.PullRequestListOptions) ([]*github.PullRequest, *github.Response, error) {
713-
// Convert PullRequestListOptions to ListOptions
714-
listOpts := &github.ListOptions{
715-
Page: opts.Page,
716-
PerPage: opts.PerPage,
717-
}
718-
return a.service.ListPullRequestsWithCommit(ctx, owner, repo, sha, listOpts)
719-
}

pkg/services/github_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ func TestGitHubService_Send_PullRequestCommentWithTag(t *testing.T) {
429429
}
430430

431431
// Update mock implementation to match the interface from github.go
432-
func (m *mockPullRequestsService) ListPullRequestsWithCommit(ctx context.Context, owner, repo, sha string, opts *github.PullRequestListOptions) ([]*github.PullRequest, *github.Response, error) {
432+
func (m *mockPullRequestsService) ListPullRequestsWithCommit(ctx context.Context, owner, repo, sha string, opts *github.ListOptions) ([]*github.PullRequest, *github.Response, error) {
433433
return m.prs, nil, nil
434434
}
435435

0 commit comments

Comments
 (0)