I’m using the Vercel CLI, and I have 2 custom branches configured. qa and develop. My production branch is main.
When I’m triggering a deploy via Github Actions, I can’t specify the develop branch in vercel deploy.
You can do this with vercel pull of course, but I’m actually triggering the build on Vercel, not building it locally and using --prebuilt, so I don’t think that works for me.
I found a relevant bit of discussion on this from when --git-branch was originally added.
Hey @kjrocker. Welcome and thanks for reaching out!
If you have the GitHub repo connected, the branch should be picked up automatically so the right branch-specific environment variables would be used even if you don’t do a prebuilt deployment.
That’s how it works for my test app setup where I set git.deploymentEnabled to false and only deploy with vercel deploy --token=${{ secrets.VERCEL_TOKEN }} in a GitHub workflow. The branch is still detected and the environment variable set for that branch is used.
Someone shared their “deploy preview” GitHub workflow in another post. It works by first checking out the desired commit so the CLI can pick up the branch metadata