Skip to content

BitByBit-B3/cf-pr-preview-action

Repository files navigation

cf-pr-preview-action

cf-pr-preview-action

Give every pull request its own isolated, ephemeral Cloudflare preview — a per-PR Worker wired to a per-PR D1, KV, and R2 — auto-deployed, dev data synced, migrations applied, and torn down when the PR closes.

CI Marketplace Release License: MIT

📖 Documentation → cf-pr-preview.bbyb.dev

Full guides, syncing, and the complete input/output reference live on the docs site.

Quick start

name: Preview
on:
  pull_request:
    types: [opened, synchronize, reopened, closed]
permissions:
  contents: read
  pull-requests: write
jobs:
  preview:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: oven-sh/setup-bun@v2
        with: { bun-version: 1.3.14 }
      - run: bun install
      - uses: BitByBit-B3/cf-pr-preview-action@v1
        with:
          worker-prefix: myapp-preview
          db-prefix: myapp-preview
        env:
          CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

Open a PR → get an isolated Worker + D1 + KV + R2 at a workers.dev URL, migrations applied, a sticky comment with the link, and automatic teardown on close.

Development

bun install
bun run typecheck
bun test
bun run build     # bundles src → dist/index.cjs (committed)

dist/index.cjs is the committed entrypoint the action runs; CI fails if it drifts from src. Docs live in docs/ (VitePress). See CONTRIBUTING.

License

MIT © BitByBit-B3

About

GitHub Action for per-PR Cloudflare preview environments: an isolated Worker, D1, KV & R2 for every pull request — auto-deployed with dev data sync and migrations, torn down on close.

Topics

Resources

License

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors