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): make every remaining CI checkout shallow (#35997)
Mateo Wang6d604d27a603
diff --git a/.github/workflows/create_daily_oss_agent_shin_branch.yml b/.github/workflows/create_daily_oss_agent_shin_branch.ymlindex d6118f3b53c..9baf9f142f6 100644--- a/.github/workflows/create_daily_oss_agent_shin_branch.yml+++ b/.github/workflows/create_daily_oss_agent_shin_branch.yml@@ -13,35 +13,16 @@ jobs:contents: writesteps:- - name: Checkout repository- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0- with:- fetch-depth: 0- persist-credentials: false-- name: Create daily oss-agent-shin branchenv:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}run: |- # Configure Git user- git config user.name "github-actions[bot]"- git config user.email "github-actions[bot]@users.noreply.github.com"-- # Generate branch name with MM_DD_YYYY formatBRANCH_NAME="litellm_oss_agent_shin_$(date +'%m_%d_%Y')"echo "Creating branch: $BRANCH_NAME"-- # Fetch all branches- git fetch --all-- # Check if the branch already exists- if git show-ref --verify --quiet refs/remotes/origin/$BRANCH_NAME; then+ if gh api "repos/${{ github.repository }}/git/ref/heads/$BRANCH_NAME" --silent 2>/dev/null; thenecho "Branch $BRANCH_NAME already exists. Skipping creation."- else- echo "Creating new branch: $BRANCH_NAME"- # Create the new branch from main- git checkout -b $BRANCH_NAME origin/main- # Push the new branch- git push origin $BRANCH_NAME- echo "Successfully created and pushed branch: $BRANCH_NAME"+ exit 0fi+ MAIN_SHA=$(gh api "repos/${{ github.repository }}/git/ref/heads/main" --jq '.object.sha')+ gh api "repos/${{ github.repository }}/git/refs" -f ref="refs/heads/$BRANCH_NAME" -f sha="$MAIN_SHA" --silent+ echo "Successfully created branch: $BRANCH_NAME at $MAIN_SHA"diff --git a/.github/workflows/create_daily_staging_branch.yml b/.github/workflows/create_daily_staging_branch.ymlindex 424d8de0a41..6422b0d4dbc 100644--- a/.github/workflows/create_daily_staging_branch.yml+++ b/.github/workflows/create_daily_staging_branch.yml@@ -13,38 +13,19 @@ jobs:contents: writesteps:- - name: Checkout repository- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0- with:- fetch-depth: 0- persist-credentials: false-- name: Create daily staging branchenv:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}run: |- # Configure Git user- git config user.name "github-actions[bot]"- git config user.email "github-actions[bot]@users.noreply.github.com"-- # Generate branch name with MM_DD_YYYY formatBRANCH_NAME="litellm_oss_staging_$(date +'%m_%d_%Y')"echo "Creating branch: $BRANCH_NAME"-- # Fetch all branches- git fetch --all-- # Check if the branch already exists- if git show-ref --verify --quiet refs/remotes/origin/$BRANCH_NAME; then+ if gh api "repos/${{ github.repository }}/git/ref/heads/$BRANCH_NAME" --silent 2>/dev/null; thenecho "Branch $BRANCH_NAME already exists. Skipping creation."- else- echo "Creating new branch: $BRANCH_NAME"- # Create the new branch from main- git checkout -b $BRANCH_NAME origin/main- # Push the new branch- git push origin $BRANCH_NAME- echo "Successfully created and pushed branch: $BRANCH_NAME"+ exit 0fi+ MAIN_SHA=$(gh api "repos/${{ github.repository }}/git/ref/heads/main" --jq '.object.sha')+ gh api "repos/${{ github.repository }}/git/refs" -f ref="refs/heads/$BRANCH_NAME" -f sha="$MAIN_SHA" --silent+ echo "Successfully created branch: $BRANCH_NAME at $MAIN_SHA"create-internal-dev-branch:if: github.repository == 'BerriAI/litellm'@@ -53,35 +34,16 @@ jobs:contents: writesteps:- - name: Checkout repository- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0- with:- fetch-depth: 0- persist-credentials: false-- name: Create internal dev branchenv:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}run: |- # Configure Git user- git config user.name "github-actions[bot]"- git config user.email "github-actions[bot]@users.noreply.github.com"-- # Generate branch name with MM_DD_YYYY formatBRANCH_NAME="litellm_internal_dev_$(date +'%m_%d_%Y')"echo "Creating branch: $BRANCH_NAME"-- # Fetch all branches- git fetch --all-- # Check if the branch already exists- if git show-ref --verify --quiet refs/remotes/origin/$BRANCH_NAME; then+ if gh api "repos/${{ github.repository }}/git/ref/heads/$BRANCH_NAME" --silent 2>/dev/null; thenecho "Branch $BRANCH_NAME already exists. Skipping creation."- else- echo "Creating new branch: $BRANCH_NAME"- # Create the new branch from main- git checkout -b $BRANCH_NAME origin/main- # Push the new branch- git push origin $BRANCH_NAME- echo "Successfully created and pushed branch: $BRANCH_NAME"+ exit 0fi+ MAIN_SHA=$(gh api "repos/${{ github.repository }}/git/ref/heads/main" --jq '.object.sha')+ gh api "repos/${{ github.repository }}/git/refs" -f ref="refs/heads/$BRANCH_NAME" -f sha="$MAIN_SHA" --silent+ echo "Successfully created branch: $BRANCH_NAME at $MAIN_SHA"diff --git a/.github/workflows/test-linting.yml b/.github/workflows/test-linting.ymlindex 61cab0bc37b..f4938de2821 100644--- a/.github/workflows/test-linting.yml+++ b/.github/workflows/test-linting.yml@@ -170,7 +170,7 @@ jobs:steps:- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0with:- fetch-depth: 0+ fetch-depth: 1persist-credentials: false- name: Set up Python@@ -185,13 +185,14 @@ jobs:- name: Run secret scan testrun: |- uv run --frozen --with 'pytest==9.0.2' pytest tests/litellm/test_no_hardcoded_secrets.py -v+ uv run --no-project --with 'pytest==9.0.2' pytest tests/litellm/test_no_hardcoded_secrets.py -v- name: Run ggshield secret scanenv:GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }}run: |if [ -n "$GITGUARDIAN_API_KEY" ]; then+ git fetch --no-tags --unshallow originuv tool run --from 'ggshield==1.48.0' ggshield secret scan repo .elseecho "GITGUARDIAN_API_KEY not set, skipping ggshield scan"diff --git a/.github/workflows/test-litellm-ui-lint.yml b/.github/workflows/test-litellm-ui-lint.ymlindex 2c31abc6609..ecc739a87e2 100644--- a/.github/workflows/test-litellm-ui-lint.yml+++ b/.github/workflows/test-litellm-ui-lint.yml@@ -22,12 +22,13 @@ jobs:- name: Checkout repositoryuses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0with:- fetch-depth: 0+ fetch-depth: 1persist-credentials: false- name: Collect changed filesid: changedenv:+ GH_TOKEN: ${{ github.token }}BASE_SHA: ${{ github.event.pull_request.base.sha }}HEAD_SHA: ${{ github.event.pull_request.head.sha }}run: |@@ -37,7 +38,9 @@ jobs:# landed since, so a PR that touches no UI file still gets linted# against hundreds of other people's files. Diff the PR head against its# own merge base instead, which is exactly what this PR changed.- merge_base=$(git merge-base "$BASE_SHA" "$HEAD_SHA")+ 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" "$HEAD_SHA": > "$RUNNER_TEMP/prettier_files.txt": > "$RUNNER_TEMP/eslint_files.txt"while IFS= read -r f; dodiff --git a/.github/workflows/test-litellm-ui-unit.yml b/.github/workflows/test-litellm-ui-unit.ymlindex 20c3611eb38..8f2199017d9 100644--- a/.github/workflows/test-litellm-ui-unit.yml+++ b/.github/workflows/test-litellm-ui-unit.yml@@ -29,7 +29,7 @@ jobs:- name: Checkout repositoryuses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0with:- fetch-depth: 0+ fetch-depth: 1persist-credentials: false- name: Setup Node.js@@ -45,11 +45,24 @@ jobs:- name: Run UI unit tests (Vitest)env:CI: "true"+ GH_TOKEN: ${{ github.token }}BASE_SHA: ${{ github.event.pull_request.base.sha }}+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}run: |if [ -n "$BASE_SHA" ]; then- echo "Pull request: running only tests related to changes since $BASE_SHA"- npm run test -- --run --changed "$BASE_SHA" --passWithNoTests \+ 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" "$HEAD_SHA"+ changed_files=()+ while IFS= read -r f; do+ changed_files+=("$f")+ done < <(git diff --name-only --relative "$merge_base" "$HEAD_SHA" -- .)+ if [ ${#changed_files[@]} -eq 0 ]; then+ echo "No UI files changed in this PR; skipping unit tests."+ exit 0+ fi+ echo "Pull request: running tests related to ${#changed_files[@]} changed UI files"+ npm run test -- related "${changed_files[@]}" --run --passWithNoTests \--pool forks --poolOptions.forks.maxForks=14elseecho "Push to $GITHUB_REF_NAME: running the full suite"