From 53cbb1fa779f6e9f14809d33af0bbb730ff35735 Mon Sep 17 00:00:00 2001 From: zugdev Date: Sat, 25 Jan 2025 12:49:14 -0300 Subject: [PATCH] feat: map partner avatars --- src/main.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index 9fef1543..5fbd41a3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -16,7 +16,7 @@ export async function main() { const partnerRepoUrls = await getPartnerRepoUrls(); const taskList: GitHubIssue[] = []; const pullRequestList: GitHubPullRequest[] = []; - const partnerAvatarList: OrgNameAndAvatarUrl[] = []; + const partnerAvatarMap: Map = new Map(); // for each project URL for (const partnerRepoUrl of partnerRepoUrls) { @@ -29,11 +29,15 @@ export async function main() { const pullRequests: GitHubPullRequest[] = await getRepositoryPullRequests(ownerName, repoName); pullRequestList.push(...pullRequests); - // get partner profile picture - const org: OrgNameAndAvatarUrl = await getPartnerAvatars(ownerName); - partnerAvatarList.push(org); + // get partner profile picture if not already in the map + if (!partnerAvatarMap.has(ownerName)) { + const org: OrgNameAndAvatarUrl = await getPartnerAvatars(ownerName); + partnerAvatarMap.set(ownerName, org); + } } + const partnerAvatarList: OrgNameAndAvatarUrl[] = Array.from(partnerAvatarMap.values()); + await commitTasks(taskList); await commitPullRequests(pullRequestList); await commitPartnerAvatars(partnerAvatarList);