Worker GitHub Actions Pipeline
Section titled “Worker GitHub Actions Pipeline”This repo now has one guarded Worker pipeline for pull requests and post-merge Cloudflare deploys.
What runs on every pull request
Section titled “What runs on every pull request”The Worker Pipeline workflow runs on pull requests into main or master and must pass before merge:
- Install Worker and Controller dependencies with
npm ci. - Run the legacy immutable-test guard.
- Run the Worker pipeline immutable guard.
- Verify the pipeline workflow still has PR tests, protected deploy gating, Cloudflare secrets, local-AI deploy settings, and shard deployment concurrency.
- Generate and verify local-AI Wrangler configs.
- Type-check the Worker.
- Type-check the Controller.
- Run the local-AI deployment lock regression.
- Run the fully mocked offline Worker E2E regression.
What deploys after merge
Section titled “What deploys after merge”After a PR merges into main or master, the same workflow runs the full CI job again. The Deploy Workers to Cloudflare job starts only after CI passes and only on a push to main or master.
The deploy job does this:
- Validates required GitHub secrets are present.
- Generates production Wrangler shard configs with local AI first and OpenAI fallback enabled.
- Deploys all generated Worker shards to Cloudflare, five at a time.
- Deploys the controller Worker to Cloudflare.
Required GitHub secrets
Section titled “Required GitHub secrets”Add these in GitHub → repo → Settings → Secrets and variables → Actions:
CLOUDFLARE_API_TOKENCLOUDFLARE_ACCOUNT_IDNUTSNEWS_SECRETS_STORE_IDNUTSNEWS_KV_NAMESPACE_IDLOCAL_AI_URL
Optional secrets:
NUTSNEWS_KV_PREVIEW_NAMESPACE_IDLOCAL_AI_API_KEY_SECRET_NAME
Optional repository variables:
ENABLE_UPSTASH_REDIS_SECRET_BINDINGUPSTASH_REDIS_REST_URL_SECRET_NAMEUPSTASH_REDIS_REST_TOKEN_SECRET_NAMEENABLED_SUMMARY_LANGUAGESSUMMARY_TRANSLATION_LIMITHOLD_ARTICLES_FOR_TRANSLATIONS
Immutable tests policy
Section titled “Immutable tests policy”Rami’s rule: tests and deployment guardrails are non-modifiable unless explicitly approved.
The new guard uses .github/worker-pipeline-immutable.manifest and blocks edits to these files after the first PR lands:
.github/workflows/worker-pipeline.ymlscripts/check_worker_pipeline_immutable.mjsscripts/verify_worker_pipeline_config.mjsscripts/deploy_worker_shards.mjs.github/worker-pipeline-immutable.manifest
Only set NUTSNEWS_APPROVE_PIPELINE_TEST_CHANGES=true after Rami explicitly approves a test or pipeline guardrail change.
Branch protection to turn this into an enforced gate
Section titled “Branch protection to turn this into an enforced gate”In GitHub branch protection, make Worker Pipeline / Worker pipeline tests a required status check for main or master.
That is the part that makes GitHub block merges when someone removes or bypasses the workflow. Without branch protection, the workflow still runs, but GitHub will not force maintainers to wait for it.
Manual deploy
Section titled “Manual deploy”You can still run the deploy pipeline manually from GitHub Actions with workflow_dispatch. Manual runs execute the CI job first. The deploy job is intentionally limited to push events on main or master, so use a merge to deploy production.
