mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-04-21 10:06:47 +00:00
CICO-111286: Handle error on duplicate review comments
This commit is contained in:
parent
51393ab4c1
commit
d129a930b3
3 changed files with 21 additions and 5 deletions
11
dist/index.js
vendored
11
dist/index.js
vendored
|
@ -51,7 +51,7 @@ const minimatch_1 = __importDefault(__nccwpck_require__(2002));
|
|||
const GITHUB_TOKEN = core.getInput("GITHUB_TOKEN");
|
||||
const OPENAI_API_KEY = core.getInput("OPENAI_API_KEY");
|
||||
const OPENAI_API_MODEL = core.getInput("OPENAI_API_MODEL");
|
||||
const FRAMEWORK = core.getInput("framework"); // New input for framework
|
||||
const FRAMEWORK = core.getInput("framework");
|
||||
const octokit = new rest_1.Octokit({ auth: GITHUB_TOKEN });
|
||||
const openai = new openai_1.default({
|
||||
apiKey: OPENAI_API_KEY,
|
||||
|
@ -462,12 +462,19 @@ function createComment(file, chunk, aiResponses) {
|
|||
}
|
||||
function createReviewComment(owner, repo, pull_number, comments) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const validComments = comments.filter(comment => comment.path && comment.line > 0 && comment.body.trim() !== "");
|
||||
if (validComments.length === 0) {
|
||||
console.log("No valid comments to add");
|
||||
return;
|
||||
}
|
||||
yield octokit.pulls.createReview({
|
||||
owner,
|
||||
repo,
|
||||
pull_number,
|
||||
comments,
|
||||
comments: validComments,
|
||||
event: "COMMENT",
|
||||
}).catch(error => {
|
||||
console.error("Error creating review comment:", error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue