Skip to content

ADR 008: Implement FinOps Cost Analyzer

  • Status: Proposed
  • Date: 2026-02-24
  • Author: Victoria Cheng

Context and Problem Statement

CI/CD workflows consume compute minutes with no visibility into their dollar cost. GitHub surfaces raw duration in the UI but does not correlate it to billing amounts or provide per-workflow cost trends. Without this data, identifying expensive workflows, justifying optimization efforts, and tracking cost-per-feature metrics is not possible. The Get Workflow Run Usage billing API is also being deprecated, requiring a new approach to cost estimation.

Decision Outcome

Implement a finops-cost-analyzer as a reusable composite GitHub Action that calculates the estimated cost of a workflow run. The action uses the stable listJobsForWorkflowRun API to retrieve per-job timing data, applies configurable per-minute rates based on runner OS (Linux, Windows, macOS), and outputs a structured JSON cost report. The action is calculation-only; downstream consumption (PR comments, webhooks, dashboards) is the responsibility of the calling workflow.

Consequences

Positive

  • Cost Visibility: Provides dollar-amount estimates per job and per workflow run.
  • Configurable Pricing: Per-minute rates are inputs with sensible defaults, adapting to GitHub pricing changes without code modifications.
  • Composable Design: JSON output can be consumed by any downstream system (webhook, artifact, PR comment) without coupling the action to a specific backend.
  • Stable API: Uses listJobsForWorkflowRun instead of the deprecated billing endpoint.

Negative

  • Estimation Only: Cost figures are estimates based on published rates, not actual billing data from GitHub.
  • Public Repo Caveat: GitHub-hosted runners are free for public repos; the action reports what the cost would be for a private repo equivalent.
  • Self-Hosted Gap: Self-hosted runners have no GitHub billing cost; the action needs to handle these gracefully.

Verification

  • [ ] Cost Calculation: The action correctly calculates duration and cost for Linux, Windows, and macOS jobs.
  • [ ] Output Format: The cost-report output is valid, parseable JSON with the expected schema.
  • [ ] Edge Cases: Jobs without completed_at are handled gracefully (excluded or estimated).
  • [ ] Integration: The action runs successfully as a step in the test-actions.yml workflow.