How to create Supabase branch on GitHub branch push rather than on Pull Request?
Hello, I have a project that is hosted on Vercel and using Supabase for all the data stuff. The project is already set up with a GitHub connection and a Vercel integration. However, when pushing a branch, it is not creating the Supabase environment, therefore the Vercel preview deployment doesn't have the required environment variables from Supabase, yielding a deployment error.
What I've been doing is, first push the branch, wait for the Vercel deployment (which will fail because of the missing environment variables), go to Supabase and manually create the preview branch, and then re-deploy on Vercel.
Is there a way to configure the Supabase integration so it creates the branch as soon as it is pushed?
6 Replies
May be this is what your are looking for: https://supabase.com/docs/guides/deployment/branching
Yes, I followed that guide. I mean, it works when I open a PR, but I want to see if there is a way to create the preview branch when pushing the git branch, and not when opening a PR.
Branching | Supabase Docs
Use Supabase Branches to test and preview changes.
I haven't used it my self, but it looks like that covers your use case
Yes, that's what I'm doing; I'm manually creating the preview branch. My question is how to automate the process and let Supabase automatically create the preview branch?
If you want to automate it you need to build a pipeline for it, or update the one provided, I can't help you with github actions as I only have experience with gitlab pipelines
But it's basically going to be the same as running the CLI commands in your terminal but just in the yaml script.
https://supabase.com/docs/guides/functions/examples/github-actions