Skip to content

Commit 4486e5c

Browse files
committed
rebase
1 parent b79abbe commit 4486e5c

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

github-mcp-server

11.3 MB
Binary file not shown.

pkg/github/pullrequests.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ func AddPullRequestReviewComment(client *github.Client, t translations.Translati
558558
if err != nil {
559559
return mcp.NewToolResultError(err.Error()), nil
560560
}
561-
pullNumber, err := requiredInt(request, "pull_number")
561+
pullNumber, err := RequiredInt(request, "pull_number")
562562
if err != nil {
563563
return mcp.NewToolResultError(err.Error()), nil
564564
}
@@ -586,12 +586,13 @@ func AddPullRequestReviewComment(client *github.Client, t translations.Translati
586586
comment.InReplyTo = github.Ptr(int64(replyToFloat))
587587
} else {
588588
// Handle subject_type parameter
589-
subjectType, err := optionalParam[string](request, "subject_type")
589+
subjectType, err := OptionalParam[string](request, "subject_type")
590590
if err != nil {
591591
return mcp.NewToolResultError(err.Error()), nil
592592
}
593593
if subjectType == "file" {
594594
// When commenting on a file, no line/position fields are needed
595+
// No action needed
595596
} else {
596597
// Handle line or position-based comments
597598
line, lineExists := request.Params.Arguments["line"].(float64)
@@ -684,11 +685,11 @@ func ReplyToPullRequestReviewComment(client *github.Client, t translations.Trans
684685
if err != nil {
685686
return mcp.NewToolResultError(err.Error()), nil
686687
}
687-
pullNumber, err := requiredInt(request, "pull_number")
688+
pullNumber, err := RequiredInt(request, "pull_number")
688689
if err != nil {
689690
return mcp.NewToolResultError(err.Error()), nil
690691
}
691-
commentID, err := requiredInt(request, "comment_id")
692+
commentID, err := RequiredInt(request, "comment_id")
692693
if err != nil {
693694
return mcp.NewToolResultError(err.Error()), nil
694695
}

pkg/github/pullrequests_test.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,7 +1575,11 @@ func Test_AddPullRequestReviewComment(t *testing.T) {
15751575
mock.PostReposPullsCommentsByOwnerByRepoByPullNumber,
15761576
http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
15771577
w.WriteHeader(http.StatusCreated)
1578-
json.NewEncoder(w).Encode(mockComment)
1578+
err := json.NewEncoder(w).Encode(mockComment)
1579+
if err != nil {
1580+
http.Error(w, err.Error(), http.StatusInternalServerError)
1581+
return
1582+
}
15791583
}),
15801584
),
15811585
),
@@ -1686,7 +1690,11 @@ func Test_ReplyToPullRequestReviewComment(t *testing.T) {
16861690
mock.PostReposPullsCommentsByOwnerByRepoByPullNumber,
16871691
http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
16881692
w.WriteHeader(http.StatusCreated)
1689-
json.NewEncoder(w).Encode(mockReply)
1693+
err := json.NewEncoder(w).Encode(mockReply)
1694+
if err != nil {
1695+
http.Error(w, err.Error(), http.StatusInternalServerError)
1696+
return
1697+
}
16901698
}),
16911699
),
16921700
),
@@ -1728,7 +1736,7 @@ func Test_ReplyToPullRequestReviewComment(t *testing.T) {
17281736
t.Run(tc.name, func(t *testing.T) {
17291737
mockClient := github.NewClient(tc.mockedClient)
17301738

1731-
_, handler := replyToPullRequestReviewComment(mockClient, translations.NullTranslationHelper)
1739+
_, handler := ReplyToPullRequestReviewComment(mockClient, translations.NullTranslationHelper)
17321740

17331741
request := createMCPRequest(tc.requestArgs)
17341742

0 commit comments

Comments
 (0)