From 0306dec95806d11e369b7c1520262d51af3766d1 Mon Sep 17 00:00:00 2001 From: Hassieb Pakzad <68423100+hassiebp@users.noreply.github.com> Date: Thu, 7 May 2026 11:15:53 +0200 Subject: [PATCH] ci(docs): resolve matching docs branch for validation --- .github/workflows/test-code-quality.yml | 22 ++++++++++++++++++- .github/workflows/test-unit-documentation.yml | 22 ++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-code-quality.yml b/.github/workflows/test-code-quality.yml index 4f09857eb1b..97f66acd412 100644 --- a/.github/workflows/test-code-quality.yml +++ b/.github/workflows/test-code-quality.yml @@ -25,10 +25,30 @@ jobs: with: persist-credentials: false + - name: Resolve litellm-docs checkout source + id: docs_source + env: + DOCS_FORK_REPO: ${{ github.event.pull_request.head.repo.owner.login }}/litellm-docs + DOCS_FORK_BRANCH: ${{ github.head_ref }} + run: | + DOCS_REPOSITORY="BerriAI/litellm-docs" + DOCS_REF="main" + + if git ls-remote --exit-code --heads \ + "https://github.com/${DOCS_FORK_REPO}.git" \ + "refs/heads/${DOCS_FORK_BRANCH}" >/dev/null 2>&1; then + DOCS_REPOSITORY="${DOCS_FORK_REPO}" + DOCS_REF="${DOCS_FORK_BRANCH}" + fi + + echo "repository=${DOCS_REPOSITORY}" >> "${GITHUB_OUTPUT}" + echo "ref=${DOCS_REF}" >> "${GITHUB_OUTPUT}" + - name: Checkout litellm-docs into docs/my-website (for documentation_tests) uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 with: - repository: BerriAI/litellm-docs + repository: ${{ steps.docs_source.outputs.repository }} + ref: ${{ steps.docs_source.outputs.ref }} path: docs/my-website persist-credentials: false diff --git a/.github/workflows/test-unit-documentation.yml b/.github/workflows/test-unit-documentation.yml index b2a8640223a..9b2f0dff09c 100644 --- a/.github/workflows/test-unit-documentation.yml +++ b/.github/workflows/test-unit-documentation.yml @@ -25,10 +25,30 @@ jobs: with: persist-credentials: false + - name: Resolve litellm-docs checkout source + id: docs_source + env: + DOCS_FORK_REPO: ${{ github.event.pull_request.head.repo.owner.login }}/litellm-docs + DOCS_FORK_BRANCH: ${{ github.head_ref }} + run: | + DOCS_REPOSITORY="BerriAI/litellm-docs" + DOCS_REF="main" + + if git ls-remote --exit-code --heads \ + "https://github.com/${DOCS_FORK_REPO}.git" \ + "refs/heads/${DOCS_FORK_BRANCH}" >/dev/null 2>&1; then + DOCS_REPOSITORY="${DOCS_FORK_REPO}" + DOCS_REF="${DOCS_FORK_BRANCH}" + fi + + echo "repository=${DOCS_REPOSITORY}" >> "${GITHUB_OUTPUT}" + echo "ref=${DOCS_REF}" >> "${GITHUB_OUTPUT}" + - name: Checkout litellm-docs into docs/my-website (for documentation_tests) uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 with: - repository: BerriAI/litellm-docs + repository: ${{ steps.docs_source.outputs.repository }} + ref: ${{ steps.docs_source.outputs.ref }} path: docs/my-website persist-credentials: false