-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test #3
test #3
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,7 +175,7 @@ exports.config = { | |
telegram: { | ||
botToken: core.getInput("TELEGRAM_BOT_TOKEN"), | ||
chatId: core.getInput("TELEGRAM_CHAT_ID"), | ||
enableBot: core.getInput("ENABLE_TELEGRAM_BOT") === 'true', | ||
enableBot: core.getInput("ENABLE_TELEGRAM_BOT") === "true", | ||
}, | ||
bot: { | ||
name: core.getInput("BOT_NAME") || "Intellizzer", | ||
|
@@ -315,18 +315,22 @@ class GitHubService { | |
console.log("Creating comment:", { | ||
path: comment.path, | ||
line: comment.line, | ||
diff_hunk: comment.diff_hunk, | ||
}); | ||
// Calculate position from diff_hunk | ||
const position = comment.diff_hunk | ||
.split("\n") | ||
.findIndex((line) => line.startsWith("+") || line.startsWith("-")) + 1; | ||
yield this.octokit.pulls.createReviewComment({ | ||
owner, | ||
repo, | ||
pull_number, | ||
body: comment.body, | ||
path: comment.path, | ||
position, | ||
line: comment.line, | ||
commit_id: comment.commit_id, | ||
side: "RIGHT", | ||
diff_hunk: comment.diff_hunk, | ||
in_reply_to: undefined, // Add optional in_reply_to parameter | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Intellizzer: The |
||
}); | ||
// Add a small delay between comments | ||
yield new Promise((resolve) => setTimeout(resolve, 1000)); | ||
|
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,18 +84,22 @@ class GitHubService { | |
console.log("Creating comment:", { | ||
path: comment.path, | ||
line: comment.line, | ||
diff_hunk: comment.diff_hunk, | ||
}); | ||
// Calculate position from diff_hunk | ||
const position = comment.diff_hunk | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Intellizzer: The variable |
||
.split("\n") | ||
.findIndex((line) => line.startsWith("+") || line.startsWith("-")) + 1; | ||
yield this.octokit.pulls.createReviewComment({ | ||
owner, | ||
repo, | ||
pull_number, | ||
body: comment.body, | ||
path: comment.path, | ||
position, | ||
line: comment.line, | ||
commit_id: comment.commit_id, | ||
side: "RIGHT", | ||
diff_hunk: comment.diff_hunk, | ||
in_reply_to: undefined, // Add optional in_reply_to parameter | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Intellizzer: The |
||
}); | ||
// Add a small delay between comments | ||
yield new Promise((resolve) => setTimeout(resolve, 1000)); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,19 +90,27 @@ export class GitHubService { | |
console.log("Creating comment:", { | ||
path: comment.path, | ||
line: comment.line, | ||
diff_hunk: comment.diff_hunk, | ||
}); | ||
|
||
// Calculate position from diff_hunk | ||
const position = | ||
comment.diff_hunk | ||
.split("\n") | ||
.findIndex( | ||
(line) => line.startsWith("+") || line.startsWith("-") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Intellizzer: The use of |
||
) + 1; | ||
|
||
await this.octokit.pulls.createReviewComment({ | ||
owner, | ||
repo, | ||
pull_number, | ||
body: comment.body, | ||
path: comment.path, | ||
line: comment.line, | ||
position, | ||
line: comment.line, // Add required line parameter | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Intellizzer: The comment |
||
commit_id: comment.commit_id, | ||
side: "RIGHT", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Intellizzer: The comment |
||
diff_hunk: comment.diff_hunk, | ||
in_reply_to: undefined, // Add optional in_reply_to parameter | ||
}); | ||
|
||
// Add a small delay between comments | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intellizzer:
The calculation of
position
should handle cases wherecomment.diff_hunk
might not contain any lines starting with+
or-
. This could lead to unexpected results if thefindIndex
method returns-1
, which would cause an incorrect position to be used.