Change production branch name for pages direct deployment
Hey all, I've been deploying my pages projects using github actions (wrangler cli / wrangler action). I'm in the process of changing github repositories for the projects and as a result of this, the "default" production branch name has changed from
master
to main
.
However, when I do a deployment using wrangler pages deploy public/
it makes a preview deployment on the main branch. This makes sense since the default branch is configured to be master
.
Does anyone know how to change the "default" branch for a pages project? I poked around in the settings but couldn't find anything.
Relevant info
- account id: 87a3c637ba57424b09104e5ade4caffe3 Replies
Never mind, I found the solution on GitHub.
For anyone who comes across this, the following curl command works
Github comment reference - https://github.com/cloudflare/pages-action/issues/63#issuecomment-1513903702
You can create a production deployment from any branch by overriding the branch name to the one which is the default branch for production deployment. E.g. if I have checked out
stage
branch and I want to create a production deployment from this branch, then it can be achieved by executing wrangler pages deploy ./dist --project-name <project_name> --branch main
command from the current branch.This should be in the docs
https://developers.cloudflare.com/api/operations/pages-project-update-project Looks like the API docs are not displaying the parameters properly