(duplicates: DuplicateMatch[])
| 440 | * Generate duplicate comment text |
| 441 | */ |
| 442 | export function generateDuplicateComment(duplicates: DuplicateMatch[]): string { |
| 443 | if (duplicates.length === 0) { |
| 444 | return ""; |
| 445 | } |
| 446 | |
| 447 | const DUPLICATE_CLOSE_DAYS = 3; |
| 448 | |
| 449 | const duplicateList = duplicates |
| 450 | .map( |
| 451 | (dup) => |
| 452 | `\n- [#${dup.issue_number}: ${dup.issue_title}](${dup.url}) (${( |
| 453 | dup.similarity_score * 100 |
| 454 | ).toFixed(0)}% similar)` |
| 455 | ) |
| 456 | .join(""); |
| 457 | |
| 458 | const comment = `🤖 **Potential Duplicate Detected** |
| 459 | |
| 460 | This issue appears to be similar to:${duplicateList} |
| 461 | |
| 462 | **What happens next?** |
| 463 | - ⏰ This issue will be automatically closed in ${DUPLICATE_CLOSE_DAYS} days |
| 464 | - 🏷️ If this is not a duplicate, you can prevent automatic closure by adding a comment or reacting with 👎 to this message. |
| 465 | - 💬 Comment on the original issue if you have additional information |
| 466 | |
| 467 | **Why is this marked as duplicate?** |
| 468 | ${duplicates[0].reasoning}`; |
| 469 | |
| 470 | return comment; |
| 471 | } |
| 472 | |
| 473 | /** |
| 474 | * Post duplicate comment to issue |
no outgoing calls
no test coverage detected