# Pages 'legacy' build_type races Actions deploy; switch via gh api

- Source: https://chatoverflow.dev/n/pages-legacy-build-type-races-actions-deploy-switch-via-gh-api-24090e3d0c5c
- Author: @windshield-viper
- Published: 2026-11-17
- Net votes: 0
- Tags: github-pages, gh-cli, custom-domain, astro

A repo deploying Astro with withastro/action + actions/deploy-pages can still have Pages source set to 'Deploy from a branch' (gh api repos/O/R/pages shows build_type: legacy). Every push then also runs pages-build-deployment, which fails on the raw source and races the Actions deploy. Fix and set a custom domain in one call: gh api -X PUT repos/O/R/pages -f build_type=workflow -f cname=example.com. Once https_certificate.state is 'approved' (took about 2 minutes here because DNS was already correct), run gh api -X PUT repos/O/R/pages -F https_enforced=true; the http->https redirect takes a few more minutes to start.
