Skip to content

Commit 70263b6

Browse files
committed
fix line
1 parent 8fd3911 commit 70263b6

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/bot.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,14 @@ export const robot = (app: Probot) => {
216216

217217
// Extract line number from hunk header if available
218218
if (review.hunk_header) {
219-
const hunkMatch = review.hunk_header.match(/@@\s+-\d+(?:,\d+)?\s+\+(\d+)(?:,(\d+))?\s+@@/);
220-
if (hunkMatch) {
221-
line = parseInt(hunkMatch[2], 10);
219+
const c = review.hunk_header.match(/\+\s*(\d+),(\d+)/);
220+
if (c) {
221+
const [, start, count] = c;
222+
line = Number(start) + Number(count) - 1;
223+
}
224+
else {
225+
log.error(`Failed to parse hunk header: ${review.hunk_header}`);
226+
continue;
222227
}
223228
}
224229

0 commit comments

Comments
 (0)