Skip to content

Commit 52898a3

Browse files
committed
build
1 parent 509ede3 commit 52898a3

File tree

5 files changed

+25
-12
lines changed

5 files changed

+25
-12
lines changed

dist/index.js

+6-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/services/github.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,21 @@ class GitHubService {
8585
path: comment.path,
8686
line: comment.line,
8787
});
88+
// Calculate position from diff_hunk
89+
const position = comment.diff_hunk
90+
.split("\n")
91+
.findIndex((line) => line.startsWith("+") || line.startsWith("-")) + 1;
8892
yield this.octokit.pulls.createReviewComment({
8993
owner,
9094
repo,
9195
pull_number,
9296
body: comment.body,
9397
path: comment.path,
98+
position,
9499
line: comment.line,
95100
commit_id: comment.commit_id,
96101
side: "RIGHT",
97-
start_line: comment.line,
98-
start_side: "RIGHT",
99-
subject_type: "line", // Add subject_type
102+
in_reply_to: undefined, // Add optional in_reply_to parameter
100103
});
101104
// Add a small delay between comments
102105
yield new Promise((resolve) => setTimeout(resolve, 1000));

src/services/github.ts

+11-4
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,25 @@ export class GitHubService {
9292
line: comment.line,
9393
});
9494

95+
// Calculate position from diff_hunk
96+
const position =
97+
comment.diff_hunk
98+
.split("\n")
99+
.findIndex(
100+
(line) => line.startsWith("+") || line.startsWith("-")
101+
) + 1;
102+
95103
await this.octokit.pulls.createReviewComment({
96104
owner,
97105
repo,
98106
pull_number,
99107
body: comment.body,
100108
path: comment.path,
101-
line: comment.line,
109+
position,
110+
line: comment.line, // Add required line parameter
102111
commit_id: comment.commit_id,
103112
side: "RIGHT",
104-
start_line: comment.line, // Add start_line
105-
start_side: "RIGHT", // Add start_side
106-
subject_type: "line", // Add subject_type
113+
in_reply_to: undefined, // Add optional in_reply_to parameter
107114
});
108115

109116
// Add a small delay between comments

src/types/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface ReviewComment {
1111
path: string;
1212
line: number;
1313
commit_id: string;
14-
diff_hunk?: string;
14+
diff_hunk: string;
1515
}
1616

1717
export interface AIReviewResponse {

0 commit comments

Comments
 (0)