Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4007 authored Oct 3, 2024
1 parent 3a360b9 commit e7890fd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/handlers/issue-deduplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,17 @@ async function handleSimilarIssuesComment(context: Context, payload: IssuePayloa
})
);

let finalIdx = 0;
let finalIndex = 0;
const commentBody = issueList
.filter((issue) =>
matchRepoOrgToSimilarIssueRepoOrg(payload.repository.owner.login, issue.node.repository.owner.login, payload.repository.name, issue.node.repository.name)
)
.map((issue, index) => {
const modifiedUrl = issue.node.url.replace("https://github.com", "https://www.github.com");
finalIdx += 1;
return `[^0${index + 1}^]: [${issue.node.title}](${modifiedUrl}) ${issue.similarity}%`;
})
.join("\n");
const footnoteLinks = [...Array(finalIdx).keys()].map((i) => `[^0${i + 1}^]`).join("");
const footnoteLinks = [...Array(++finalIndex).keys()].map((i) => `[^0${i + 1}^]`).join("");
const body = "\n###### Similar " + footnoteLinks + "\n\n" + commentBody;

// Remove the existing foot note
Expand Down

0 comments on commit e7890fd

Please sign in to comment.