litellm/.github/workflows/check-api-breaking-changes.yml
ryan-crabbe-berri 8f36f040bc ci: fail PRs that change the public litellm API without declaring it
Adds a griffe-based CI gate over the importable litellm SDK surface. Breaking
changes (removed objects, changed signatures, changed defaults) need a
Conventional Commits declaration, either a bang after the type or a
BREAKING CHANGE: footer. Newly exported top-level names need a feat: or fix:
title so a chore/refactor PR cannot quietly widen the public API.

Scope is deliberately narrower than raw griffe output: litellm.proxy.* is
excluded because the proxy's contract is HTTP rather than Python, and
re-exported stdlib names are excluded because their canonical home is another
package. On a 17-day sample window that took the finding count from 46 to 11,
with all 11 genuine.
2026-08-07 13:36:31 -07:00

50 lines
1.4 KiB
YAML

name: Check Public API for Breaking Changes
on:
pull_request:
branches:
- main
- litellm_internal_staging
- litellm_oss_staging
- "litellm_**"
paths:
- "litellm/**/*.py"
- ".github/scripts/check_api_breaking_changes.py"
- ".github/workflows/check-api-breaking-changes.yml"
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
check-public-api:
name: Diff the public API against the base branch
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout PR
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
with:
fetch-depth: 0
persist-credentials: false
- name: Set up uv
uses: ./.github/actions/setup-uv-with-retries
with:
version: "0.10.9"
- name: Diff public API
env:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_BODY: ${{ github.event.pull_request.body }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
uv run --no-project --with griffe==2.1.0 \
python .github/scripts/check_api_breaking_changes.py \
--repo . \
--base-ref "$BASE_SHA" \
--pr-title "$PR_TITLE" \
--pr-body "$PR_BODY"