mirror of
https://github.com/supabase/supabase.git
synced 2026-05-06 22:18:00 +08:00
fix: Set the default branch if it's not already set on Github integration (#44332)
Previously, the POST to `/v1/projects/{ref}/branches` didn't work on
free projects, which left some Supabase projects setup without a default
branch. Easy fix for those projects would be to disable/enable the whole
integration.
This PR fixes that so that when the user wants to setup a production
sync, the code checks if there's branches already setup and if not, sets
the selected branch as default.
---------
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
This commit is contained in:
@@ -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 ||
|
||||
|
||||
Reference in New Issue
Block a user