From 939b1c40e82333e93e7a8ac4e7d4505c4b91d31c Mon Sep 17 00:00:00 2001 From: Gilbert Date: Wed, 8 May 2024 22:27:58 -0500 Subject: [PATCH] Fix default branch bug --- packages/backend/src/service.ts | 1 + .../pages/org-slug/projects/create/template/index.tsx | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/service.ts b/packages/backend/src/service.ts index bfee770..c87f125 100644 --- a/packages/backend/src/service.ts +++ b/packages/backend/src/service.ts @@ -202,6 +202,7 @@ export class Service { subOrgId: params.subOrgId, ethAddress: params.ethAddress, isVerified: true, + turnkeyWalletId: params.turnkeyWalletId, }); await this.db.addUserOrganization({ diff --git a/packages/frontend/src/pages/org-slug/projects/create/template/index.tsx b/packages/frontend/src/pages/org-slug/projects/create/template/index.tsx index 6bef456..a044944 100644 --- a/packages/frontend/src/pages/org-slug/projects/create/template/index.tsx +++ b/packages/frontend/src/pages/org-slug/projects/create/template/index.tsx @@ -64,9 +64,16 @@ const CreateRepo = () => { return; } + // Refetch to always get correct default branch + const templateRepo = await octokit.rest.repos.get({ + owner: template.repoFullName.split('/')[0], + repo: template.repoFullName.split('/')[1], + }); + const prodBranch = templateRepo.data.default_branch ?? 'main'; + const { addProject } = await client.addProject(orgSlug!, { name: `${gitRepo.data.owner!.login}-${gitRepo.data.name}`, - prodBranch: gitRepo.data.default_branch ?? 'main', + prodBranch, repository: gitRepo.data.full_name, // TODO: Set selected template template: 'webapp',