The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(ci): fetch only head and merge-base in lint jobs instead of every branch (#35982)
Mateo Wang7c9c9ffbc744
diff --git a/.github/workflows/test-linting.yml b/.github/workflows/test-linting.ymlindex b539ec4be88..61cab0bc37b 100644--- a/.github/workflows/test-linting.yml+++ b/.github/workflows/test-linting.yml@@ -23,10 +23,21 @@ jobs:# Any-discipline) would otherwise blame on this branch.with:ref: ${{ github.event.pull_request.head.sha }}- fetch-depth: 0+ fetch-depth: 1clean: truepersist-credentials: false+ - name: Fetch gate base (merge-base with target branch)+ env:+ GH_TOKEN: ${{ github.token }}+ BASE_SHA: ${{ github.event.pull_request.base.sha }}+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}+ run: |+ MERGE_BASE=$(gh api "repos/${{ github.repository }}/compare/${BASE_SHA}...${HEAD_SHA}?per_page=1" --jq '.merge_base_commit.sha')+ test -n "$MERGE_BASE"+ git fetch --no-tags --depth=1 origin "$MERGE_BASE"+ echo "GATE_BASE_SHA=$MERGE_BASE" >> "$GITHUB_ENV"+- name: Set up Pythonuses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0with:@@ -60,10 +71,8 @@ jobs:uv run --no-sync prisma generate --schema litellm/proxy/schema.prisma- name: Check ruff format- env:- BASE_SHA: ${{ github.event.pull_request.base.sha }}run: |- git diff --name-only --diff-filter=ACMR "$BASE_SHA"...HEAD -- 'litellm/**/*.py' | grep -v '^litellm/enterprise/' > "$RUNNER_TEMP/ruff_format_files.txt" || true+ git diff --name-only --diff-filter=ACMR "$GATE_BASE_SHA" HEAD -- 'litellm/**/*.py' | grep -v '^litellm/enterprise/' > "$RUNNER_TEMP/ruff_format_files.txt" || trueif [ ! -s "$RUNNER_TEMP/ruff_format_files.txt" ]; thenecho "No changed litellm Python files to check with ruff format."exit 0@@ -86,32 +95,24 @@ jobs:cd ..- name: Check strict-rule budget (delta vs base)- env:- BASE_SHA: ${{ github.event.pull_request.base.sha }}run: |- uv run --no-sync python scripts/ruff_strict_gate.py --base "$BASE_SHA"+ uv run --no-sync python scripts/ruff_strict_gate.py --base "$GATE_BASE_SHA"- name: Check type-discipline budget (mutable collections / casts / type guards / kwargs / unexplained suppressions, delta vs base)- env:- BASE_SHA: ${{ github.event.pull_request.base.sha }}run: |- uv run --no-sync python scripts/type_discipline_gate.py --base "$BASE_SHA"+ uv run --no-sync python scripts/type_discipline_gate.py --base "$GATE_BASE_SHA"- name: Print OpenAI versionrun: |uv run --no-sync python -c "import openai; print(f'OpenAI version: {openai.__version__}')"- name: Check basedpyright budget (delta vs base)- env:- BASE_SHA: ${{ github.event.pull_request.base.sha }}run: |- uv run --no-sync python scripts/type_check_gate.py --base "$BASE_SHA"+ uv run --no-sync python scripts/type_check_gate.py --base "$GATE_BASE_SHA"- name: Check tests/e2e basedpyright (zero errors)- env:- BASE_SHA: ${{ github.event.pull_request.base.sha }}run: |- if git diff --name-only --diff-filter=ACMRD "$BASE_SHA"...HEAD -- 'tests/e2e/**/*.py' | grep -q .; then+ if git diff --name-only --diff-filter=ACMRD "$GATE_BASE_SHA" HEAD -- 'tests/e2e/**/*.py' | grep -q .; thenuv run --no-sync basedpyright tests/e2eelseecho "No changed tests/e2e Python files; skipping."@@ -140,9 +141,15 @@ jobs:steps:- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0with:- fetch-depth: 0+ fetch-depth: 1persist-credentials: false+ - name: Fetch ratchet base+ env:+ BASE_SHA: ${{ github.event.pull_request.base.sha }}+ run: |+ git fetch --no-tags --depth=1 origin "$BASE_SHA"+- name: Set up Pythonuses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0with: