GitHub branches and CI
Create the GitHub repository
Section titled “Create the GitHub repository”- Create
amplify-astro-cicdunder your user or org (private or public) - Push your local scaffold as
main
git init -b maingit add .git commit -m "feat: scaffold minimal astro sample for amplify
Initial Astro app with amplify.yml for Hosting builds."git remote add origin git@github.com:<org>/amplify-astro-cicd.gitgit push -u origin mainAdd the staging branch
Section titled “Add the staging branch”git checkout -b staginggit push -u origin staginggit checkout mainAmplify will use both branch names later. Feature work always starts from a new branch off staging or main and opens a PR into staging first.
Minimal CI gate
Section titled “Minimal CI gate”Add .github/workflows/ci.yml:
name: CI
on: pull_request: push: branches: [main, staging]
permissions: contents: read
jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: "22" cache: npm - run: npm ci - run: npm run buildThis is the CI gate
GitHub Actions checks plus branch protection - required before merge. Amplify does not wait for CI by itself; it builds on push. Amplify will not enforce for you.
Branch protection (recommended)
Section titled “Branch protection (recommended)”On staging and main:
- Require a pull request before merging
- Require the CI workflow to pass
- Disallow force pushes
Next: Create Amplify app.