Netlify Build Plugin

Your credits.
Your rules.

Automatically cancel cloud builds. Deploy from your machine instead. Zero credits spent. Infinite deploys.

Get Started npm i netlify-plugin-credit-shield
300,000,000 credits saved by the shield
12,847 cloud builds cancelled
$0 surprise bills

Protect any project in 2 minutes

1

Install the plugin

npm install netlify-plugin-credit-shield --save-dev
2

Add to netlify.toml

[[plugins]]
package = "netlify-plugin-credit-shield"

  [plugins.inputs]
    mode = "production"    # block production, keep deploy previews
3

Push to GitHub

Every push to your production branch triggers the shield. Deploy previews still work normally.

⚙️ Configuration options

InputValuesDefaultDescription
modeproduction, all, warn, offproductionWhen to cancel builds
blockBranchescomma-separated branches""Block only these branches (overrides mode)
allowBranchescomma-separated branches""Always allow these branches (overrides everything)
trackUrlURL 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

Build locally + deploy to production. Auto-detects npm run build and dist folder. Zero credits.

npx credit-shield preview

Same as deploy but creates a Netlify deploy preview. No --prod flag. Review before shipping.

npx credit-shield status

Check credit usage from Netlify API. Shows build minutes consumed, recent builds, account details. Opt-in via NETLIFY_AUTH_TOKEN.

npx credit-shield track

View cancelled build stats from the credit tracker API. Total builds saved, recent blocks.

your-terminal — zsh
$ npx credit-shield deploy
🛡️ Credit Shield — PRODUCTION DEPLOY
Build: build
Dist dir: dist
📦 Building...
✓ built in 2.8s — dist/ is ready
🚀 Deploying...
✓ deployed to production
✅ Deploy complete — 0 credits used.

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

SecretWhere to get it
NETLIFY_AUTH_TOKENNetlify → User Settings → Applications → Personal Access Tokens
NETLIFY_SITE_IDNetlify → 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.

Credit Shield badge

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.

your-terminal — zsh
$ NETLIFY_AUTH_TOKEN=nfp_xxx npx credit-shield status
🛡️ Credit Shield Status
Account: jovylle
Type: personal
Build mins: 12 / 300 used
Sites: 8
Recent builds:
✅ my-site — 2026-07-10 — 3min
❌ blog — 2026-07-09 — 0min (cancelled)
✅ portfolio — 2026-07-09 — 2min

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.