File tree Expand file tree Collapse file tree 7 files changed +31
-14
lines changed
Expand file tree Collapse file tree 7 files changed +31
-14
lines changed Original file line number Diff line number Diff 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"
4949branding :
5050 icon : " cpu"
5151 color : " red"
52- author : ' Blizzer'
52+ author : " Blizzer"
Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ exports.config = {
175175 telegram: {
176176 botToken: core.getInput("TELEGRAM_BOT_TOKEN"),
177177 chatId: core.getInput("TELEGRAM_CHAT_ID"),
178- enableBot: core.getInput("ENABLE_TELEGRAM_BOT") === ' true' ,
178+ enableBot: core.getInput("ENABLE_TELEGRAM_BOT") === " true" ,
179179 },
180180 bot: {
181181 name: core.getInput("BOT_NAME") || "Intellizzer",
@@ -315,18 +315,22 @@ class GitHubService {
315315 console.log("Creating comment:", {
316316 path: comment.path,
317317 line: comment.line,
318- diff_hunk: comment.diff_hunk,
319318 });
319+ // Calculate position from diff_hunk
320+ const position = comment.diff_hunk
321+ .split("\n")
322+ .findIndex((line) => line.startsWith("+") || line.startsWith("-")) + 1;
320323 yield this.octokit.pulls.createReviewComment({
321324 owner,
322325 repo,
323326 pull_number,
324327 body: comment.body,
325328 path: comment.path,
329+ position,
326330 line: comment.line,
327331 commit_id: comment.commit_id,
328332 side: "RIGHT",
329- diff_hunk: comment.diff_hunk,
333+ in_reply_to: undefined, // Add optional in_reply_to parameter
330334 });
331335 // Add a small delay between comments
332336 yield new Promise((resolve) => setTimeout(resolve, 1000));
Original file line number Diff line number Diff 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" ,
Original file line number Diff line number Diff 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 ) ) ;
Original file line number Diff line number Diff 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" ,
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments