A Cloudflare Worker + Workflow service that optionally waits for the latest deployment of a Worker and then either redeploys another Worker or POSTs a Cloudflare deploy hook URL.
This supports both Workers Builds deploy hooks and a direct Worker redeploy flow for cases such as static-asset-only Workers where a deploy hook URL is not available.
zodevlog/workerspnpm install
Copy .env.example to .env and use a user API token with access to the Workers resources needed to inspect deployments and, if you use cloudflare.to_redeploy.worker, trigger a rebuild.
CLOUDFLARE_API_TOKEN=...
Run locally:
pnpm run dev
Trigger a worker redeploy after another worker deployment is successful:
POST /url
Content-Type: application/json
{
"cloudflare": {
"to_wait": {
"worker": "talks"
},
"to_redeploy": {
"worker": "my-static-worker"
}
}
}
Trigger a Cloudflare deploy hook URL after another worker deployment is successful:
POST /url
Content-Type: application/json
{
"deploy_hook_url": "https://api.cloudflare.com/client/v4/workers/builds/deploy_hooks/abc123",
"cloudflare": {
"to_wait": {
"worker": "talks"
}
}
}
[!NOTE]
Ifcloudflare.to_redeploy.workeris provided, the worker redeploy path is used.deploy_hook_urlis only required when you want to trigger a deploy hook instead.
[!NOTE]
cloudflare.to_redeploy.workeris useful for Workers that cannot be redeployed through a deploy hook URL, such as static Workers.
Trigger a Cloudflare deploy hook URL immediately without waiting:
POST /url
Content-Type: application/json
{
"deploy_hook_url": "https://api.cloudflare.com/client/v4/workers/builds/deploy_hooks/abc123"
}
Redeploy a worker immediately without waiting:
POST /url
Content-Type: application/json
{
"cloudflare": {
"to_redeploy": {
"worker": "my-static-worker"
}
}
}
If input is invalid (malformed JSON or schema mismatch), the API returns 400 Bad Request.
pnpm installpnpm run devpnpm run lintpnpm run deploypnpm run cf-typegenWhen running locally, you can use HTTPie to test the API. This is easier than using a GUI like Postman.
Trigger a worker redeploy after another worker deployment is successful:
http --verbose --json POST localhost:8787/url \
cloudflare:='{"to_wait":{"worker":"talks"},"to_redeploy":{"worker":"my-static-worker"}}' \
x-service:soubiran.dev
Trigger a deploy hook URL after another worker deployment is successful:
http --verbose --json POST localhost:8787/url \
deploy_hook_url=https://api.cloudflare.com/client/v4/workers/builds/deploy_hooks/abc123 \
cloudflare:='{"to_wait":{"worker":"talks"}}' \
x-service:soubiran.dev
Trigger a deploy hook URL immediately:
http --verbose --json POST localhost:8787/url \
deploy_hook_url=https://api.cloudflare.com/client/v4/workers/builds/deploy_hooks/abc123 \
x-service:soubiran.dev
Redeploy a worker immediately:
http --verbose --json POST localhost:8787/url \
cloudflare:='{"to_redeploy":{"worker":"my-static-worker"}}' \
x-service:soubiran.dev
[!NOTE]
Remember to use real target names that exist in your Cloudflare account.
Quick negative tests:
# Wrong route (expect 404)
http --verbose --json POST localhost:8787/soubiran-dev cloudflare:='{"to_wait":{"worker":"talks"}}'
# Invalid body shape (expect 400: neither trigger target is provided)
http --verbose --json POST localhost:8787/url cloudflare:='{"to_wait":{"worker":"talks"}}'
# Invalid body shape (expect 400: invalid deploy hook URL)
http --verbose --json POST localhost:8787/url deploy_hook_url=not-a-url
# Malformed JSON (expect 400)
echo '{bad json' | http --verbose POST localhost:8787/url Content-Type:application/json
MIT License © 2026-PRESENT Estéban Soubiran
We use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.