Skip to content

About

Cloudflare Pages and Workers build status for Herdr: a header icon, a popup with the latest build, and notifications when a deploy fails.

Topics

Resources

Stars

18 stars

Watchers

0 watching

Forks

Repository files navigation

Cloudflare Deploys for Herdr

See whether your Cloudflare Pages and Workers deploys went live without leaving Herdr.

Cloudflare Deploys

A cloud icon sits in Herdr's header. It spins while a build is running, turns red if the last build failed and green when it's live. Click it to see the latest build and the recent deploys of each project. If a deploy fails, you get a notification.

Projects are found from the repos your spaces are open in: any wrangler.toml / wrangler.json in the repo, plus Pages projects connected to the repo through the Cloudflare dashboard. There's nothing to list by hand.

It only reads from Cloudflare. It never deploys or changes anything.

Setup (Herdr app)

1. Copy the mod

git clone https://github.com/SaifHarding/herdr-cloudflare
cp -R herdr-cloudflare/mods/cloudflare-deploys ~/.config/herdr-app/mods/

2. Put the icon in your header

Herdr's built-in layouts are read-only, so make your own copy first (skip this if you already use your own layout):

herdr-app do layout.clone '{"name":"main","as":"my-layout"}'

Open ~/.config/herdr-app/layouts/my-layout.json and find the tab bar:

{ "id": "tabs", "type": "block", "content": { "mod": "tabs" }, "size": { "px": 42 } }

Replace it with a row holding the tab bar and the icon:

{ "id": "tabs-row", "type": "row", "size": { "px": 42 }, "children": [
  { "id": "tabs", "type": "block", "size": { "weight": 1 }, "content": { "mod": "tabs" } },
  { "id": "cloudflare-bar", "type": "block", "size": { "px": 56 },
    "content": { "mod": "cloudflare-deploys", "props": { "bar": true } } }
] }

Save. Herdr picks it up right away. If something's off, herdr-app status shows the error.

3. Sign in to Cloudflare

Click the icon, then the sign-in button (the arrow into a box). It opens a tab with npx wrangler login. Finish in the browser and the popup fills in within a few seconds.

Already logged in with wrangler? Skip this.

Settings (optional)

The settings button in the popup creates and opens ~/.config/cloudflare-deploys/.env. Everything in it is optional:

Setting Default What it does
CF_API_TOKEN, CF_ACCOUNT_ID none Use the Cloudflare API instead of wrangler. Faster, and the only way to see Workers build failures.
CF_NOTIFY failures all also tells you when a deploy goes live. off for no notifications.
CF_PROJECTS none Projects outside your spaces, e.g. pages:my-site,worker:my-api.
CF_POLL_SECONDS 30 How often to check. Every 10 s while a build runs.
CF_WRANGLER auto How to run wrangler, if not the project's own or npx wrangler@4.

For an API token, create one at dash.cloudflare.com → My Profile → API Tokens with read access to Cloudflare Pages, Workers Scripts and Workers CI. Read-only is enough.

Without a token

Wrangler can show Pages builds fine, but for Workers it only lists deployments that succeeded. A Workers build that failed won't show up unless you add a token. Pages rows also won't have commit messages.

Also works in the herdr terminal app

If you use herdr in the terminal rather than the desktop app, this repo is also a herdr plugin:

herdr plugin install SaifHarding/herdr-cloudflare

From a herdr pane, herdr plugin action invoke open-dashboard --plugin cloudflare.deploys opens a live dashboard. It reads the same settings file.

Troubleshooting

  • Icon shows a yellow dot or "unavailable". Hover it to see the error. Usually wrangler isn't logged in: use the sign-in button.
  • "No Cloudflare projects in your spaces". None of your spaces is open in a repo with a wrangler config or a Pages project connected to it. Open one, or add it to CF_PROJECTS.
  • wrangler says you're logged out everywhere. Check for a ~/.wrangler folder. wrangler treats it as its config folder and ignores your login. Delete it (it only holds caches) and log in again. This mod never runs wrangler from your home folder, so it won't create one.

Development

npm test                                        # no dependencies
herdr-app check mods/cloudflare-deploys         # load the mod once
cp -R mods/cloudflare-deploys ~/.config/herdr-app/mods/   # try it live

RECIPE.md describes the mod in full, for rebuilding it or changing it.

License

MIT

About

Cloudflare Pages and Workers build status for Herdr: a header icon, a popup with the latest build, and notifications when a deploy fails.

Topics

Resources

Stars

18 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages