Schedule icon
Request icon
Get icon
Script icon
Docker icon
Set icon
If icon
SlackIncomingWebhook icon
Log icon
Return icon

GitHub Actions Spending Limit & Billing Quota Sentinel

Audit GitHub Actions billing, track quota burn rates, and alert before spending limits freeze CI/CD pipelines.

Categories
CloudCore

Orchestrates continuous FinOps cost governance for GitHub Actions by monitoring organization billable minutes, tracking shared artifact storage, projecting month-end burn rates, and alerting engineering teams before spending limit caps freeze continuous integration pipelines.

How it works

  1. API Telemetry Ingestion: Queries the GitHub REST API billing endpoints GET /orgs/{org}/settings/billing/actions and GET /orgs/{org}/settings/billing/shared-storage. Also samples recent completed workflow runs from the primary monitored repository.
  2. Burn Rate & Quota Computation: Runs an isolated Python task that extracts paid minutes, included allowances, runner breakdown, and shared storage gigabytes. It evaluates elapsed cycle days, calculates daily spend burn rate, and models projected end-of-month expenditure.
  3. KV Telemetry Persistence: Stores structured billing telemetry, spend deltas, and quota metrics into the Kestra Key-Value store under key github_billing_actions_{org}.
  4. Spending Gate Evaluation & Alerting: Compares consumption and burn rate projections against warning (80%) and critical (95%) thresholds. If a limit breach or freeze risk is detected, the workflow formats a multi-section alert block and posts it to Slack via incoming webhook.

Architecture diagram

flowchart TD
    A[daily_billing_audit Schedule] --> B[get_actions_billing HTTP Request]
    B --> C[get_shared_storage_billing HTTP Request]
    C --> D[get_workflow_runs HTTP Request]
    D --> E[get_previous_billing_telemetry KV Get]
    E --> F[compute_billing_sentinel_metrics Python Script]
    F --> G[save_billing_telemetry_kv KV Set]
    G --> H{evaluate_spending_gate If}
    H -- Alert Triggered --> I[alert_slack_quota_breach Slack]
    H -- Nominal --> J[log_healthy_quota Log]
    I --> K[export_billing_manifest Return]
    J --> K

What you get

  • Real-time visibility into GitHub Actions paid minutes and artifact storage costs.
  • Proactive burn-rate forecasting that flags impending budget exhaustion before billing cycle resets.
  • Immediate warnings before GitHub applies spending limit freezes to private repositories.
  • Identification of top minute-consuming workflows to prioritize CI optimization efforts.
  • Historical telemetry retained in Kestra Key-Value store for cross-execution auditability.

Who it's for

  • DevOps and Platform Engineers managing enterprise CI/CD infrastructure on GitHub.
  • FinOps Specialists auditing cloud developer tooling expenditure.
  • Engineering Managers ensuring build pipelines remain operational without unplanned outages.

Why orchestrate this with Kestra

  • Native Declarative HTTP Tasks: Eliminates the overhead of maintaining dedicated polling microservices or serverless functions.
  • Integrated Key-Value Store: Preserves previous audit snapshots natively to track spend deltas across executions without external databases.
  • Secure Credential Handling: Resolves GitHub tokens and Slack webhook URLs securely through Kestra encrypted secrets.
  • Reliable Automation: Combines declarative scheduling with built-in error escalation handlers to guarantee sentinel continuity.

Prerequisites

  • GitHub Personal Access Token (classic or fine-grained) or GitHub App token with admin:org or Organization Billing read permissions.
  • Incoming Webhook URL configured in your target Slack workspace.
  • Docker container runner enabled on Kestra worker nodes.

Secrets

  • GITHUB_TOKEN: GitHub authentication token with authorization to access organization billing endpoints.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL configured to receive FinOps incident alerts.

Quick start

  1. Configure the GITHUB_TOKEN and SLACK_WEBHOOK_URL secrets in your Kestra namespace.
  2. Import this blueprint flow YAML into your Kestra instance.
  3. Set github_org to your organization slug and configure monthly_spending_limit_usd to match your account settings.
  4. Execute the flow manually to inspect current Actions consumption and verify Slack message delivery.
  5. Enable the daily_billing_audit schedule trigger to establish automated recurring surveillance.

How to extend

  • Automated Workflow Throttling: Add a step that automatically cancels non-critical CI workflows or PR checks when critical freeze thresholds are breached.
  • Dynamic Spending Limit Modification: Integrate PUT /orgs/{org}/settings/billing/actions to update monthly spending limits automatically following manager Slack approval.
  • Data Warehouse Ingestion: Stream the emitted export_billing_manifest payload to Snowflake, BigQuery, or ClickHouse for multi-quarter FinOps reporting.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.