Skip to content

Commit 90da6ab

Browse files
authored
Merge pull request #3 from blizzertech/dev
2 parents d926a51 + 52898a3 commit 90da6ab

File tree

7 files changed

+31
-14
lines changed

7 files changed

+31
-14
lines changed

action.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ inputs:
3030
ENABLE_TELEGRAM_BOT:
3131
description: "Enable Telegram bot functionality"
3232
required: false
33-
default: 'false'
33+
default: "false"
3434

3535
BOT_NAME:
3636
description: "Name of the bot that will appear in comments"
@@ -49,4 +49,4 @@ runs:
4949
branding:
5050
icon: "cpu"
5151
color: "red"
52-
author: 'Blizzer'
52+
author: "Blizzer"

dist/index.js

+7-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/config/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ exports.config = {
4444
telegram: {
4545
botToken: core.getInput("TELEGRAM_BOT_TOKEN"),
4646
chatId: core.getInput("TELEGRAM_CHAT_ID"),
47-
enableBot: core.getInput("ENABLE_TELEGRAM_BOT") === 'true',
47+
enableBot: core.getInput("ENABLE_TELEGRAM_BOT") === "true",
4848
},
4949
bot: {
5050
name: core.getInput("BOT_NAME") || "Intellizzer",

lib/services/github.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,22 @@ class GitHubService {
8484
console.log("Creating comment:", {
8585
path: comment.path,
8686
line: comment.line,
87-
diff_hunk: comment.diff_hunk,
8887
});
88+
// Calculate position from diff_hunk
89+
const position = comment.diff_hunk
90+
.split("\n")
91+
.findIndex((line) => line.startsWith("+") || line.startsWith("-")) + 1;
8992
yield this.octokit.pulls.createReviewComment({
9093
owner,
9194
repo,
9295
pull_number,
9396
body: comment.body,
9497
path: comment.path,
98+
position,
9599
line: comment.line,
96100
commit_id: comment.commit_id,
97101
side: "RIGHT",
98-
diff_hunk: comment.diff_hunk,
102+
in_reply_to: undefined, // Add optional in_reply_to parameter
99103
});
100104
// Add a small delay between comments
101105
yield new Promise((resolve) => setTimeout(resolve, 1000));

src/config/index.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export const config = {
77
openai: {
88
apiKey: core.getInput("OPENAI_API_KEY"),
99
model: core.getInput("OPENAI_API_MODEL"),
10-
apiEndpoint: core.getInput("OPENAI_API_ENDPOINT") || "https://api.openai.com/v1",
10+
apiEndpoint:
11+
core.getInput("OPENAI_API_ENDPOINT") || "https://api.openai.com/v1",
1112
queryConfig: {
1213
temperature: 0.2,
1314
max_tokens: 700,
@@ -19,7 +20,7 @@ export const config = {
1920
telegram: {
2021
botToken: core.getInput("TELEGRAM_BOT_TOKEN"),
2122
chatId: core.getInput("TELEGRAM_CHAT_ID"),
22-
enableBot: core.getInput("ENABLE_TELEGRAM_BOT") === 'true',
23+
enableBot: core.getInput("ENABLE_TELEGRAM_BOT") === "true",
2324
},
2425
bot: {
2526
name: core.getInput("BOT_NAME") || "Intellizzer",

src/services/github.ts

+11-3
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,27 @@ export class GitHubService {
9090
console.log("Creating comment:", {
9191
path: comment.path,
9292
line: comment.line,
93-
diff_hunk: comment.diff_hunk,
9493
});
9594

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+
96103
await this.octokit.pulls.createReviewComment({
97104
owner,
98105
repo,
99106
pull_number,
100107
body: comment.body,
101108
path: comment.path,
102-
line: comment.line,
109+
position,
110+
line: comment.line, // Add required line parameter
103111
commit_id: comment.commit_id,
104112
side: "RIGHT",
105-
diff_hunk: comment.diff_hunk,
113+
in_reply_to: undefined, // Add optional in_reply_to parameter
106114
});
107115

108116
// Add a small delay between comments

0 commit comments

Comments
 (0)