A simple Cloudflare Worker that exposes the latest Cloudflare Pages deployment status as a Shields.io badge.
Use this to show the deploy status of your Cloudflare Pages project right in your GitHub README.
- ✅ Shows real deployment status: passing, building, failing, canceled, or fallback active.
- ✅ Supports filtering by branch (main, feature branch, etc).
- ✅ Optional environment label (production vs preview).
- ✅ Returns proper Shields endpoint JSON schema.
- ✅ Deployable in minutes with Wrangler v3.



git clone https://github.com/sunpech/cloudflare-pages-status-badge.git
cd cloudflare-pages-status-badge
npm installname = "cloudflare-pages-status-badge"
main = "src/worker.ts"
compatibility_date = "2025-10-03"
workers_dev = true
[observability]
enabled = trueYou normally don’t need to edit this. Only change name if you want a different Worker name in your Cloudflare account.
npx wrangler secret put CLOUDFLARE_ACCOUNT_ID
npx wrangler secret put CLOUDFLARE_API_TOKEN- Account ID: find it in your Cloudflare dashboard → Workers & Pages.
- API token: create under My Profile → API Tokens with Pages:Read permissions for your account.
npx wrangler deployThis will give you a .workers.dev endpoint you can use in Shields badges.
- projectName (required): the Pages project name.
- branch (optional): filter deployments to a specific branch.
- showEnv=true (optional): label includes environment (production/preview).
{
"schemaVersion": 1,
"label": "Cloudflare Pages",
"message": "passing",
"color": "green"
}{
"schemaVersion": 1,
"label": "Cloudflare Pages",
"message": "active",
"color": "green"
}{
"schemaVersion": 1,
"label": "Cloudflare Pages",
"message": "failing",
"color": "red"
}Run locally with:
npm run devThis project was inspired by aidenwallis/cloudflare-pages-badge.
That repository no longer works with current versions of Wrangler and the Pages API, so Cloudflare Pages Status Badge was created as a modern, working alternative.
This project is licensed under the MIT License.
This project was created with the assistance of ChatGPT.
While the code works with the current Cloudflare Pages API and Wrangler CLI, it is provided as-is, without warranty. Please review, test, and adapt it for your own use cases before deploying in production.