diff --git a/.github/workflows/code-review.yaml b/.github/workflows/code-review.yaml index faeea9c..72a2bf3 100644 --- a/.github/workflows/code-review.yaml +++ b/.github/workflows/code-review.yaml @@ -24,5 +24,6 @@ jobs: max_tokens: 900 exclude: "**/*.json, **/*.md, **/*.g.dart" append_prompt: | - - Give a minimum of 0 suggestions and a maximum of 5 suggestions. - - Translate the comment in all "reviewComment" properties to portuguese (pt-br). \ No newline at end of file + - Give a maximum of 4 suggestions + - Do not suggest code formatting issues. + - Do not suggest imports issues. \ No newline at end of file diff --git a/code-review/action.js b/code-review/action.js index 7ed435b..26d08c2 100644 --- a/code-review/action.js +++ b/code-review/action.js @@ -62,6 +62,9 @@ async function analyzeCode(parsedDiff, prDetails) { for (const file of parsedDiff) { if (file.to === "/dev/null") continue; // Ignore deleted files for (const chunk of file.chunks) { + console.log("Analyzing chunk:", chunk.changes); + console.log(JSON.stringify(chunk.changes, null, 2)); + const messages = createMessages(file, chunk, prDetails); const aiResponse = await getAIResponse(messages); if (aiResponse) { @@ -79,13 +82,12 @@ function createMessages(file, chunk, prDetails) { const instructionJsonFormat = `- Always provide the response in following JSON format: [{"lineNumber": , "reviewComment": ""}]`; var contentSystemMessage = `You are a senior software engineer and your task is to review pull requests for possible bugs or bad development practices. Follow the instructions below: -- You should never give positive comments or compliments. -- You should never suggest removing empty line. -- You should not suggest adding a new line at the end of the file. -- You should never suggest to remove trailing or leading whitespace. -- You should never suggest adding comment to code. -- Avoid giving an excessive amount of suggestions for a single file. Prioritize the most important suggestions. - You will provide suggestions only if there is possible issues or bugs in the code, otherwise return an empty array. +- Do not give positive comments or compliments. +- Don't suggest removing empty line or adding line to end of file +- Don't suggest to remove trailing or leading whitespace. +- Don't suggest to remove the spaces. +- Don't suggest adding comment to code. - Do use the given pull request title and description only for the overall context and only comment the code.`; if (overridePrompt) {