Branch workflow
draft / main
Two branches. There is no preview Git branch and no “Send to preview”.
draft— the editor’s working branch. Every save is a commit here. Cloudflare Pages builds this as a preview deployment.main— production. Publish mergesdraftintomain. GitHub Actions + Bunny deploy the live site.
On push to main, sync-branches.yml merges main back into draft so the editor is never behind production.
Preview
Saving to draft is enough. Cloudflare Pages builds that commit. MagiCMS watches the GitHub check, then loads the deployment hash URL in the editor iframe (so you see this save, not an old build).
Set previewUrl in Site settings to https://*.<project>.pages.dev. The * is the hash placeholder. The Preview site link next to Live site opens the stable alias https://draft.<project>.pages.dev.
In the Cloudflare Pages project: production branch can stay main but turn automatic production deployments off (Bunny owns production). Preview branches: Custom, include draft only.
Publish
draft → main merge. The Publish button calls mergeTo('main'). Production deploy runs after the merge. The counter shows commits ahead of main.
Conflicts
HTTP 409 from the merge API. The UI shows “Publishing failed — content is safe” and offers a “Discard & reload” link that pulls fresh from main. Recovery is always possible via git.
Manual sync
When the auto-sync workflow is behind (e.g. a previous merge failed):
git checkout draft && git pull --rebase && git merge main && git push
git checkout main