Skip to main content

Lightning-paywalled FastAPI service — niche: GitHub Actions cost audit + optimization suggestions — free CLI + paid webhook alerts

Project description

milo-gh-actions-cost-audit

Audit your GitHub Actions workflows for cost waste. Free CLI. Free public-repo API. Paid Lightning-rail webhook alerts.

Lightning License: MIT Audited

Why this exists

GitHub Actions billing is opaque until your card is charged. 7 rules — derived from real-world overspend patterns (matrix.os explosion, missing cache, no timeout-minutes, oversized runners, duplicate runs on push+pr, unfiltered cron) — surface waste in under one second. Estimated savings per issue are quoted in dollars per month.

No GitHub token required for public repos. No telemetry. MIT.


3 example usages

1. CLI (local file)

pip install milo-gh-actions-cost-audit
milo-gh-actions-cost-audit .github/workflows/ci.yml
milo-gh-actions-cost-audit — CI
===============================

Jobs: 1   Triggers: push, pull_request   Runs/mo (assumed): 30
Estimated monthly cost (if private repo): $190.80
Estimated annual cost: $2289.60

Found 5 issue(s):  high=3 med=2 low=0
Total potential monthly savings: $580.86  ($6970.32/yr)

1. [HIGH] macos-large-runner (oversized_runner)
   Jobs:  test
   Fix:   Job 'test' uses macos-latest-large. macos-latest-large is $0.32/min
          vs $0.08/min for macos-latest. ... Saves: $432.00/mo ($5184.00/yr)
... (truncated)

Exit code: 0 if no high-severity issues, 1 if 1+ high-severity issues.

2. Hosted API (free, public repo)

# Free POST — any workflow YAML
curl -X POST https://gh-cost.milo.dev/audit \
  -H "Content-Type: text/plain" \
  --data-binary @.github/workflows/ci.yml

# Free GET — public repo, rate-limited 10/IP/day
curl "https://gh-cost.milo.dev/audit?repo=vercel/next.js"

3. Webhook alerts (Lightning, 100 sats/month)

# 1. Request subscription — returns HTTP 402 with BOLT-11 invoice
curl -i -X POST https://gh-cost.milo.dev/webhook/subscribe \
  -H "Content-Type: application/json" \
  -d '{"repo": "your/repo", "webhook_url": "https://your-app.com/hook"}'

# 2. Pay the BOLT-11 in any Lightning wallet (Alby, Phoenix, Zeus, WoS)

# 3. Re-call with ?payment_hash=<hash-from-402>
curl -X POST "https://gh-cost.milo.dev/webhook/subscribe?payment_hash=<hash>" \
  -H "Content-Type: application/json" \
  -d '{"repo": "your/repo", "webhook_url": "https://your-app.com/hook"}'

You get a daily audit at 03:00 UTC. If any high-severity issue appears OR the estimated monthly cost increases by >$5 from baseline, your webhook_url is called with the full audit JSON.


"Audited by" badge

Add this to your repo's README after auditing your workflows:

[![Audited](https://img.shields.io/badge/audited%20by-milo--gh--actions--cost--audit-success)](https://github.com/miloantaeus/milo-gh-actions-cost-audit)

Rules (current set)

ID Severity What it catches
matrix-os-3plus med strategy.matrix.os with 3+ OSes — usually you don't actually test OS compatibility
no-timeout-minutes high Missing timeout-minutes: — infinite-loop risk = unbounded billing
no-actions-cache med Job installs dependencies but lacks actions/cache@v4 or cache: true
macos-large-runner high macos-latest-large ($0.32/min) when macos-latest ($0.08/min) usually works
duplicate-job-on-pr-and-push high Workflow triggers on both push (unrestricted) AND pull_request — 2x cost per PR commit
ubuntu-latest-large-no-need med 8/16-core runner without parallel build commands (make -j, cargo --release, etc.)
schedule-without-condition low schedule: cron without paths: filter on push/pr — needless baseline cron

Architecture

  • Pure-Python parser (PyYAML); no external API calls for local audits.
  • Public-repo audits use GitHub's unauthenticated REST API (60 req/hr/IP global cap).
  • Lightning paywall via milo-paywall-kit (LNBits/Alby compatible).
  • FastAPI hosted endpoint deployable to Vercel/Fly/Railway.

Tests

pip install -e ".[test]"
pytest -q
# 63 passed in 0.19s

Self-deprecation criterion

Per Milo's market-truth doctrine, this SKU is deprecated if:

  • 0 webhook subscribers convert in 60 days (validates paid-tier demand), OR
  • 0 GitHub-API audits in 30 days (validates free-tier demand).

Either signal kills it without owner intervention.


License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

milo_gh_actions_cost_audit-0.1.0-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

Details for the file milo_gh_actions_cost_audit-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for milo_gh_actions_cost_audit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fa07dbd050d580f6881660a2d8d8b9d05afd16f61307a516097def5e008a90da
MD5 7f4e3256dc7093e838bcf39aaa6f1c0e
BLAKE2b-256 5468bbbbd68a81e9dd24f77a905ab263b30f4edbe058c9d7ace2ed2d090d78b8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page