Skip to main content

github-actions-quota

github-actions-quota is a small, standard-library-only Python package that measures GitHub Actions quota usage. It converts Actions billing discounts to Linux-equivalent included minutes at $0.006/min. Repositories—not this package—define their CI thresholds directly in workflow job conditions.

Installation

Add the package to a dedicated CI dependency group with uv:

uv add --group ci github-actions-quota==0.1.0

Alternatively, install it with pip:

python -m pip install github-actions-quota==0.1.0

When using the uv group, run the installed console script from the locked environment with uv run --locked --group ci github-actions-quota.

Python API

from decimal import Decimal

from github_actions_quota import calculate_usage

usage = calculate_usage(Decimal("1200"))
print(usage.usage_percent)  # 60.0

The public API also provides fetch_used_minutes and parse_used_minutes for retrieving and parsing billing usage. Personal repository owners use GitHub's user billing endpoint; organization owners use its organization billing endpoint.

Authentication and configuration

Configure trusted GitHub Actions runs with:

Repository/organization secret:
ACTIONS_QUOTA_TOKEN

Repository/organization variable:
ACTIONS_QUOTA_MINUTES=2000

The token needs Plan read permission for a user account or organization Administration read permission for an organization. The quota variable is optional and defaults to 2,000 minutes. GitHub Actions automatically supplies GITHUB_REPOSITORY_OWNER; do not configure it yourself.

Locally, ACTIONS_QUOTA_TOKEN takes precedence. When it is absent, the command uses gh auth token, so developers can run github-actions-quota after gh auth login. It resolves the current repository owner with gh when GITHUB_REPOSITORY_OWNER is also absent.

Billing always belongs to the repository owner, never GITHUB_ACTOR or a pull request author. All contributors and coding agents working in a repository therefore share its owner's quota; their personal GitHub quotas are irrelevant.

For a public repository in the normal Actions workflow context, the command reports zero percent without requiring a billing token. Included-minute quota is not applicable because standard GitHub-hosted runners are free for public repositories. This does not describe larger runners or other separately billed runner products.

CI integration

The CLI writes usage_available, used_minutes, quota_minutes, usage_percent, billing_owner, and billing_owner_type to GITHUB_OUTPUT. Keep each quality check as its own job and put readable thresholds directly in the consuming workflow:

jobs:
  quota:
    runs-on: ubuntu-latest
    outputs:
      usage_available: ${{ steps.quota.outputs.usage_available }}
      usage_percent: ${{ steps.quota.outputs.usage_percent }}
    steps:
      - uses: actions/checkout@v4
      - id: quota
        env:
          ACTIONS_QUOTA_TOKEN: ${{ secrets.ACTIONS_QUOTA_TOKEN }}
          ACTIONS_QUOTA_MINUTES: ${{ vars.ACTIONS_QUOTA_MINUTES || '2000' }}
        run: uv run --locked --group ci github-actions-quota

  tests:
    needs: quota
    if: needs.quota.outputs.usage_percent < 50
    # Test steps.

  lock:
    needs: quota
    if: needs.quota.outputs.usage_percent < 100
    # Lockfile check.

For fail-closed gating, also include needs.quota.outputs.usage_available == 'true' as this repository's workflow does. Authentication or API failures emit a warning and an unavailable result, but exit successfully so dependent jobs are intentionally skipped rather than reported as failures.

Development

Install the development tools from the lockfile with uv sync --locked --group dev. From this repository checkout, run the CLI with uv run github-actions-quota.

Metadata

Release files for github-actions-quota 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for github-actions-quota 0.1.0
File Size Uploaded
github_actions_quota-0.1.0.tar.gz 11.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for github-actions-quota 0.1.0
File Interpreter ABI Platform
github_actions_quota-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.8 kB

Release files / github_actions_quota-0.1.0.tar.gz

Download URL github_actions_quota-0.1.0.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0c3bfb0442351cc7d6bcf1f0a36a4693780b2b1ad2b13b5810cd071f2974ea86
BLAKE2b-256 checksum
How to use checksums
7688771fdd38093f60c7197a8ee3bdb1a67de7e0c3805537fc0e0db012103be4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.

Transparency log

Release files / github_actions_quota-0.1.0-py3-none-any.whl

Download URL github_actions_quota-0.1.0-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61b046980ad9cbe07f8d94942b8b0a647cb443e55635cf044e44b99478621d71
BLAKE2b-256 checksum
How to use checksums
c3644e142bbb93398f4a9ec13a7e8032d520fbbe748438866a8aa3523c6955be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page