BM: Baca dalam Bahasa Melayu
World C3: Release & Deploy
A preview for every PR
You will learn: how each pull request gets its own live link to try before merging.
Checked with GitHub Actions 2026-10 on 31 Oct 2026
The problem
A pull request changes 300 lines of CSS. The reviewer reads every line. Does the menu page still look right?
Pick one answer.
Watch
Tap each point on the timeline.
A preview environment: A short-lived copy of the site for one pull request, with its own link. A tasting plate, cleared when the PR closes. is a tasting plate for one pull request. Tap through its life.
Try it
npx wrangler preview uploads a preview of your Worker to Cloudflare. Here it runs on every pull request. Run it.
Pick an event. Press Run and watch the line.
A pull request builds and uploads its own preview.
Workflow file .github/workflows/preview.yml
name: Preview on: pull_request: permissions: contents: read jobs: preview: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - run: npm ci - run: npx wrangler preview --name "pr-$PR" env: PR: ${{ github.event.pull_request.number }} CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
The line
Pull request · feature → main
Hint
Pick Pull request, then press Run.Predict
Now a stranger opens a pull request from their fork. Will the preview deploy?
Pick one answer.
Check
Check it. Find the pull request whose preview fails, and read the real error.
Try the events. Find the one asked for.
Workflow file .github/workflows/preview.yml
name: Preview on: pull_request: permissions: contents: read jobs: preview: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - run: npm ci - run: npx wrangler preview --name "pr-$PR" env: PR: ${{ github.event.pull_request.number }} CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
The line
Pull request · feature → main
Hint
Try the pull request from a fork.Check
Preview habits: good, or needs work?
Swipe right for good, left for needs work. Or use the buttons.
Delete the preview when the pull request closes.
You did it!
You can now give every pull request its own preview.
Go deeper (optional)
Worker Previews are in open beta. Each one gets a link that updates with every push. Clean up when the pull request closes.
Workers Builds can also post the link on the pull request. Real rep (optional): add this workflow to a test Worker repo.
Bahasa Melayu
Satu pull request ubah 300 baris CSS. Penyemak baca setiap baris. Adakah halaman menu masih nampak betul?
Persekitaran pratonton ialah pinggan rasa untuk satu pull request. Tekan setiap peringkat hayatnya.
npx wrangler preview muat naik pratonton Worker anda ke Cloudflare. Di sini ia jalan pada setiap pull request. Run.
Sekarang orang luar buka pull request dari fork mereka. Adakah pratonton akan deploy?
Semak. Cari pull request yang pratontonnya gagal, dan baca ralat sebenar.
Tabiat pratonton: bagus, atau perlu diperbaiki?
Kini anda boleh beri setiap pull request pratontonnya sendiri.
You finished this before. Practice is always welcome!
Official docs: Cloudflare Workers: Previews · Cloudflare: Preview examples for CI · Events: pull_request
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?