From a90476e2b5f6831dedfe16eaafcc0364f2119810 Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Thu, 22 Aug 2024 22:16:45 -0400 Subject: [PATCH] cleanup --- .../job-agent/ConfigureJobAgentGithub.tsx | 4 +-- packages/api/src/router/github.ts | 28 +++++-------------- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/apps/nextjs/src/app/[workspaceSlug]/systems/[systemSlug]/deployments/[deploymentSlug]/configure/job-agent/ConfigureJobAgentGithub.tsx b/apps/nextjs/src/app/[workspaceSlug]/systems/[systemSlug]/deployments/[deploymentSlug]/configure/job-agent/ConfigureJobAgentGithub.tsx index b61b0345..e9f0f1a8 100644 --- a/apps/nextjs/src/app/[workspaceSlug]/systems/[systemSlug]/deployments/[deploymentSlug]/configure/job-agent/ConfigureJobAgentGithub.tsx +++ b/apps/nextjs/src/app/[workspaceSlug]/systems/[systemSlug]/deployments/[deploymentSlug]/configure/job-agent/ConfigureJobAgentGithub.tsx @@ -33,8 +33,6 @@ export const ConfigureJobAgentGithub: React.FC<{ installationId: jobAgent.config.installationId, }); - console.log({ repos: repos.data }); - const [repoOpen, setRepoOpen] = useState(false); const [repo, setRepo] = useState(value.repo ?? null); @@ -97,7 +95,7 @@ export const ConfigureJobAgentGithub: React.FC<{ - {repos.data?.map((repo) => ( + {repos.data?.data.map((repo) => ( - data.map((repo) => ({ - ...repo, - configFiles: searchResponse.data.items.filter( - (item) => item.repository.full_name === repo.full_name, - ), - })), - ); }), ), @@ -319,7 +301,7 @@ export const githubRouter = createTRPCRouter({ data: { items: configFiles }, } = searchResponse; - const parsedConfigFiles = await Promise.all( + const parsedConfigFiles = await Promise.allSettled( configFiles.map(async (cf) => { const content = await installationOctokit.repos .getContent({ @@ -349,6 +331,10 @@ export const githubRouter = createTRPCRouter({ content: parsed.data, }; }), + ).then((results) => + results + .map((r) => (r.status === "fulfilled" ? r.value : null)) + .filter(isPresent), ); const deploymentInfo = await db