litellm/.github/actions/detect-changes/action.yml
yuneng-jiang b3c464d8d3
ci: start fewer jobs per pull request (#54757)
* ci: start fewer jobs per pull request

A typical backend pull request started about 104 runners, and many of them
only checked out the repo to find their files had not changed. The unit
plan job now classifies the change once and skips ui-unit, dashboard-build,
redis-compat, python-310 and helm at the job level when their inputs did not
change, and the whole backend set on docs-only and UI-only pull requests.
unit passed still accepts a skip only for jobs the plan listed. The lint plan
does the same for the ui lint job.

Smoke runs its six core interpreters and both all-extras environments in one
job, installing the venvs in parallel and then running the existing checks in
parallel inside the loopback namespace. dashboard-build moves into the unit
workflow so the plan can gate it on the dashboard sources and the Dockerfile,
its only inputs.

ci-coverage, semgrep and the secret scans move into code-quality, the three
OpenAI SDK versions run one after another in one job, and the docs job's
checks run in lint-runtime. lint-runtime now runs on release-branch pull
requests too, where it skips import safety, the OpenAPI gate and the
code-quality checks and runs only the docs checks the docs job ran there.

* ci: give the smoke job its own uv cache and check CI coverage before the docs checkout

The combined smoke job restored the old py3.15 job's uv cache, an exact key
hit that main would never overwrite, so Python 3.14 built grpcio-tools from
source on every run (4m41s). It now uses its own cache suffix, and each
interpreter starts its checks as soon as its own install finishes.

The coverage assertions in code-quality saw the litellm-docs checkout's
Dockerfile as an unbuilt image, so they now run before that checkout.

* ci(smoke): keep 3.14 and 3.15 on their own cached runners

Those two interpreters build grpcio-tools and other packages from source when
their uv cache misses. Inside the combined job, with an empty cache and six
other installs on four CPUs, 3.14 took 13.9 minutes and 3.15 ran past the
20-minute timeout. They now run as py3.14 and py3.15 again, restoring the
same per-version caches as before, and core-checks keeps 3.10 to 3.13 and
both all-extras environments.

* ci(ui): run the dashboard unit tests on 3 shards instead of 6

* ci(ui): run the dashboard unit tests on 4 shards so the full suite stays under 10 minutes
2026-11-26 18:21:09 -08:00

41 lines
1.8 KiB
YAML

name: "Detect relevant changes"
description: >-
Classify the pull request's changed files with .github/scripts/ci/classify_changes.sh
and expose decision=run|skip for one category. backend means anything outside litellm/ui/,
docs/ and markdown; ui means the dashboard sources alone. decision=skip lets callers
short-circuit expensive steps while the job still completes successfully and satisfies
its required status check, which a paths: filter cannot do because a workflow that
never starts never reports. The file list comes from the pull request itself rather
than from a git diff, because the checked-out merge ref is recomputed as the base
branch advances and would otherwise attribute the base branch's own commits to the
pull request. The decision defaults to run for any non pull_request event or whenever
the changed set cannot be resolved, so jobs are never skipped when the classification
is uncertain.
inputs:
category:
description: "Which classification to apply: backend, client, ui, provider-harness, cost-map-only, windows-release, redis-compat, python-310, helm or dashboard-build"
required: false
default: backend
github-token:
description: "Token used to list the pull request's files; needs pull-requests: read"
required: false
default: ${{ github.token }}
outputs:
decision:
description: "run when category-relevant files changed, otherwise skip"
value: ${{ steps.classify.outputs.decision }}
runs:
using: composite
steps:
- id: classify
shell: bash
env:
GH_TOKEN: ${{ inputs.github-token }}
CATEGORY: ${{ inputs.category }}
REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
CHANGED_FILE_COUNT: ${{ github.event.pull_request.changed_files }}
run: bash "${GITHUB_ACTION_PATH}/../../scripts/detect_changes.sh"