diff --git a/.github/workflows/test-linting.yml b/.github/workflows/test-linting.yml index f7c53ff443a..ff6c40ac9ae 100644 --- a/.github/workflows/test-linting.yml +++ b/.github/workflows/test-linting.yml @@ -51,10 +51,15 @@ jobs: uv sync --frozen - name: Check ruff format + env: + BASE_SHA: ${{ github.event.pull_request.base.sha }} run: | - cd litellm - uv run --no-sync ruff format --check --line-length 88 --exclude '/enterprise/' . - cd .. + git diff --name-only "$BASE_SHA"...HEAD -- 'litellm/**/*.py' | grep -v '^litellm/enterprise/' > "$RUNNER_TEMP/ruff_format_files.txt" || true + if [ ! -s "$RUNNER_TEMP/ruff_format_files.txt" ]; then + echo "No changed litellm Python files to check with ruff format." + exit 0 + fi + xargs uv run --no-sync ruff format --check --line-length 88 --exclude '/enterprise/' < "$RUNNER_TEMP/ruff_format_files.txt" - name: Debug - Check file state run: |