CICO-111286: Add more logs to debug the dup comment issue

This commit is contained in:
Arun Murugan 2024-06-12 03:05:19 -04:00
parent 33810674fc
commit fa4ac19d74
3 changed files with 9 additions and 1 deletions

3
dist/index.js vendored
View file

@ -105,6 +105,8 @@ function getExistingComments(owner, repo, pull_number) {
function analyzeCode(parsedDiff, prDetails, existingComments) { function analyzeCode(parsedDiff, prDetails, existingComments) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const comments = []; const comments = [];
// Log the parsed diff for debugging
console.log("Parsed Diff:", JSON.stringify(parsedDiff, null, 2));
for (const file of parsedDiff) { for (const file of parsedDiff) {
if (file.to === "/dev/null") if (file.to === "/dev/null")
continue; // Ignore deleted files continue; // Ignore deleted files
@ -526,6 +528,7 @@ function main() {
return; return;
} }
const parsedDiff = (0, parse_diff_1.default)(diff); const parsedDiff = (0, parse_diff_1.default)(diff);
console.log("Parsed Diff:", JSON.stringify(parsedDiff, null, 2)); // Log parsed diff for debugging
const excludePatterns = core const excludePatterns = core
.getInput("exclude") .getInput("exclude")
.split(",") .split(",")

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View file

@ -83,6 +83,9 @@ async function analyzeCode(
): Promise<Array<{ body: string; path: string; line: number }>> { ): Promise<Array<{ body: string; path: string; line: number }>> {
const comments: Array<{ body: string; path: string; line: number }> = []; const comments: Array<{ body: string; path: string; line: number }> = [];
// Log the parsed diff for debugging
console.log("Parsed Diff:", JSON.stringify(parsedDiff, null, 2));
for (const file of parsedDiff) { for (const file of parsedDiff) {
if (file.to === "/dev/null") continue; // Ignore deleted files if (file.to === "/dev/null") continue; // Ignore deleted files
for (const chunk of file.chunks) { for (const chunk of file.chunks) {
@ -542,6 +545,8 @@ async function main() {
const parsedDiff = parseDiff(diff); const parsedDiff = parseDiff(diff);
console.log("Parsed Diff:", JSON.stringify(parsedDiff, null, 2)); // Log parsed diff for debugging
const excludePatterns = core const excludePatterns = core
.getInput("exclude") .getInput("exclude")
.split(",") .split(",")