Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: Set the default branch if it's not already set on Github integration (#44332)

Ivan Vasilov7bbd7060d395
diff --git a/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubIntegrationConnectionForm.tsx b/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubIntegrationConnectionForm.tsx
index cb022790ea9..38e7fd21d6c 100644
--- a/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubIntegrationConnectionForm.tsx
+++ b/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubIntegrationConnectionForm.tsx
@@ -323,6 +323,14 @@ export const GitHubIntegrationConnectionForm = ({
gitBranch: data.enableProductionSync ? data.branchName : '',
branchName: data.branchName || 'main',
})
+ } else {
+ // if for some reason, the project doesn't have a default branch yet, create it.
+ createBranch({
+ projectRef: selectedProject.ref,
+ gitBranch: data.enableProductionSync ? data.branchName : '',
+ branchName: data.branchName || 'main',
+ is_default: true,
+ })
}
setIsConfirmingBranchChange(false)
@@ -771,7 +779,7 @@ export const GitHubIntegrationConnectionForm = ({
</Button>
)}
<Button
- type="default"
+ type="primary"
htmlType="submit"
disabled={
!hasAccessToGitHubIntegration ||