Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

sanitize review start_line/end_line #189

Merged
merged 4 commits into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/review.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ ${comment_chain}
core.warning('No pull request found, skipping.')
continue
}
harjotgill marked this conversation as resolved.
Show resolved Hide resolved

// sanitize review's start_line and end_line
// with patches' start_line and end_line
// if needed adjust start_line and end_line
harjotgill marked this conversation as resolved.
Show resolved Hide resolved
harjotgill marked this conversation as resolved.
Show resolved Hide resolved
harjotgill marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -627,7 +628,7 @@ ${comment_chain}
}
}
}
if (!within_patch) {
if (!within_patch || review.start_line > review.end_line) {
// map the review to the closest patch
review.comment = `> Note: This review was outside of the patch, so it was mapped it to the closest patch. Original lines [${review.start_line}-${review.end_line}]
${review.comment}`
harjotgill marked this conversation as resolved.
Show resolved Hide resolved
Expand Down