Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
cache: npm
- run: npm ci
- run: npm run check
# Keep production Pages deploys on the Node suite. The Workers/D1 pool
# Keep production deploys on the Node suite. The Workers/D1 pool
# suite stays in CI via `npm test` so workerd/pool flakes cannot block
# an otherwise unrelated site deploy.
# an otherwise unrelated deploy.
- run: npm run test:node
- run: npm run build
# Migration 0001 is already applied remotely. Keep deployment fail-closed
Expand All @@ -40,6 +40,19 @@ jobs:
test "$(find worker/migrations -maxdepth 1 -type f -name '*.sql' | wc -l)" -eq 1
echo "3f820cb7c1f8e76196e83f8bc8448dd9e72e840884fc39641c84e6b9d60ff27f worker/migrations/0001_pegma_storage.sql" |
sha256sum --check --strict
# Worker before Pages: the site is a client of the worker's API, so a
# freshly deployed site must never race ahead of the API it calls.
# CLOUDFLARE_WORKER_API_TOKEN is a SEPARATE least-privileged credential
# (Workers Scripts:Edit + pegma.dev zone Workers Routes:Edit) — the
# Pages token deliberately carries no Worker authority, per the
# credential contract in docs/PROJECT_PLAN.md. Non-secret worker config
# lives in wrangler.jsonc `vars` (a deploy replaces plain vars, so
# dashboard-added vars do not survive); operator secrets persist.
- name: Deploy Worker
Comment thread
FlyOverCoderKY marked this conversation as resolved.
Resolved
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_WORKER_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: npm run worker:deploy
- name: Deploy to Cloudflare Pages
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
Expand Down
9 changes: 6 additions & 3 deletions docs/PROJECT_PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,12 @@ least-privileged D1 credential. Pull requests run the build gate but never
receive the production token; branch previews remain disabled until a
separately scoped preview credential exists.

The Worker is an explicit operator deployment until a second GitHub credential
has least-privileged Worker script plus `pegma.dev` route authority. The broad
local OAuth credential is never copied into GitHub.
The Worker deploys from the same push-to-main workflow, ordered before the
Pages deploy, using `CLOUDFLARE_WORKER_API_TOKEN` — a second, separately
least-privileged GitHub credential with Worker script plus `pegma.dev` route
authority only (the Pages token keeps no Worker authority). The broad local
OAuth credential is never copied into GitHub; `npm run worker:deploy` from an
operator session remains available as a break-glass path.

### Phase 3 — the compiled roadmap ✓ (2026-07-27)

Expand Down
12 changes: 6 additions & 6 deletions worker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ npx wrangler secret put DATADOG_SITE -c worker/wrangler.jsonc
# value: us5.datadoghq.com (or datadoghq.eu — not a full URL)
```

The GitHub deployment credential is Pages-only. Deploy this Worker from an
authenticated operator session with `npm run worker:deploy` until a separate,
least-privileged credential has both Worker script and `pegma.dev` route
authority. Do not substitute a broad personal OAuth token into GitHub. The
production Worker was operator-deployed on 2026-07-28 as version
`f627b1ee-7675-47b2-a72b-6b26210f3bb3`.
CI deploys this Worker on push to main (before the Pages deploy) using the
separate least-privileged `CLOUDFLARE_WORKER_API_TOKEN` repository secret
(Worker script + `pegma.dev` route authority only; the Pages credential keeps
no Worker authority). Do not substitute a broad personal OAuth token into
GitHub. `npm run worker:deploy` from an authenticated operator session remains
the break-glass path.

## Identity composition

Expand Down