Your credits.
Your rules.
Automatically cancel cloud builds. Deploy from your machine instead. Zero credits spent. Infinite deploys.
npm i netlify-plugin-credit-shield
Protect any project in 2 minutes
Install the plugin
npm install netlify-plugin-credit-shield --save-dev
Add to netlify.toml
[[plugins]]
package = "netlify-plugin-credit-shield"
[plugins.inputs]
mode = "production" # block production, keep deploy previews
Push to GitHub
Every push to your production branch triggers the shield. Deploy previews still work normally.
⚙️ Configuration options
| Input | Values | Default | Description |
|---|---|---|---|
mode | production, all, warn, off | production | When to cancel builds |
blockBranches | comma-separated branches | "" | Block only these branches (overrides mode) |
allowBranches | comma-separated branches | "" | Always allow these branches (overrides everything) |
trackUrl | URL to credit tracker API | "" | Opt-in: send cancellation events to your tracker |
CLI companion — one command to rule them all
Auto-detects your build command and dist folder. Installed alongside the plugin.
npx credit-shield deploy
npx credit-shield deployBuild locally + deploy to production. Auto-detects npm run build and dist folder. Zero credits.
npx credit-shield preview
npx credit-shield previewSame as deploy but creates a Netlify deploy preview. No --prod flag. Review before shipping.
npx credit-shield status
npx credit-shield statusCheck credit usage from Netlify API. Shows build minutes consumed, recent builds, account details. Opt-in via NETLIFY_AUTH_TOKEN.
npx credit-shield track
npx credit-shield trackView cancelled build stats from the credit tracker API. Total builds saved, recent blocks.
GitHub Action — skip Netlify's build pipeline entirely
Build on a GitHub runner (free). Deploy via netlify-cli. Never invoke Netlify's build infrastructure.
Option A: Composite Action
Drop-in reusable action. Setup Node, install, build, deploy — one block.
- uses: actions/checkout@v4
- uses: jovylle/netlify-plugin-credit-shield/.github/actions/credit-shield-deploy@main
with:
deploy-dir: dist
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }}
Option B: CLI in your workflow
Use the credit-shield CLI directly. Same result, more control.
- run: npm ci
- run: npx credit-shield deploy --dir=dist
Required GitHub Secrets
| Secret | Where to get it |
|---|---|
NETLIFY_AUTH_TOKEN | Netlify → User Settings → Applications → Personal Access Tokens |
NETLIFY_SITE_ID | Netlify → Site Settings → General → Site ID |
Credit Savings Tracker
Track every build the shield blocks. Real stats from the Cloudflare Pages API. Opt-in per project.
Set trackUrl = "https://credit-shield.pages.dev" in your plugin inputs to contribute to the tracker.
Badge: /api/badge
Netlify Dashboard (CLI)
See your actual Netlify credit usage. All data stays local — no tokens sent anywhere.
No auth = shows local tracker data only. With NETLIFY_AUTH_TOKEN = full API breakdown.
How it works
Git push triggers build
You push to your default branch. Netlify starts a cloud build as usual.
Shield intercepts
Before the build runs, Credit Shield fires onPreBuild, checks mode, branch, and context, then calls utils.build.cancelBuild().
You get instructions
The build log shows exact commands — manual, CLI companion, or GitHub Action. Three ways to deploy free.
Stats tracked (opt-in)
If you set trackUrl, each cancellation fires a POST to your Cloudflare Pages Functions tracker API.
Who is this for?
🧑💻 Solo devs
You push 40 times a day. Your 15 credits would last about 3 hours on Netlify's cloud build quota. Not anymore.
🏗️ Static sites
Your site builds in 2 seconds locally. Why pay Netlify to do it in 45 seconds on a shared runner?
🤝 Open source
Maintainers burning through build minutes on every PR? Shield the repo and let contributors deploy from their own machines.
💸 The budget-conscious
If the words "credit overage charge" make you nervous, this plugin was made for you.
FAQ
Does this actually work?
Yes. It's a real Netlify Build Plugin. The onPreBuild hook fires before any build steps, and utils.build.cancelBuild() is a documented Netlify Build Plugin API. The build stops instantly.
Wait, why is the landing page on Cloudflare Pages?
Irony is a dish best served on the edge. (Also Cloudflare Pages doesn't charge for build minutes.)
Will Netlify ban me for this?
No. You're using a documented plugin API. You're choosing not to use their cloud build infrastructure. That's your right.
Can I block production but keep deploy previews?
Yes — that's the default. Set mode = "production" (or leave it unset). Deploy previews and branch deploys will run normally.
Can I just warn instead of blocking?
Yes. Set mode = "warn". The plugin prints the full cancellation message but lets the build proceed. Good for testing.
Do I need the CLI if I only want the plugin?
No. The plugin and CLI are independent. Installing the npm package gives you both, but the plugin works without ever touching the CLI.
Can I use the CLI without the plugin?
Yes. npx credit-shield deploy works in any project — it's just a convenience wrapper around build + netlify-cli deploy.
Is the credit tracker sending my data somewhere?
Only if you opt in. The trackUrl input is empty by default. Set it to your own Cloudflare Pages Functions endpoint if you want to contribute to the tracker.
Does the Netlify dashboard share my token?
No. The credit-shield status command reads your NETLIFY_AUTH_TOKEN from your local environment and calls the Netlify API directly from your machine. No third-party servers involved.