diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml index e0576339af..e616d994fd 100644 --- a/.github/workflows/_test.yml +++ b/.github/workflows/_test.yml @@ -41,10 +41,10 @@ jobs: runs-on: ${{ inputs.image }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Python ${{ inputs.python-version }} - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ inputs.python-version }} diff --git a/.github/workflows/create-tag.yml b/.github/workflows/create-tag.yml index 49d6c321f8..f8b1ca163c 100644 --- a/.github/workflows/create-tag.yml +++ b/.github/workflows/create-tag.yml @@ -14,7 +14,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: ref: develop fetch-depth: 0 diff --git a/.github/workflows/docs-build.yaml b/.github/workflows/docs-build.yaml index b2b0a63e27..41e69288a0 100644 --- a/.github/workflows/docs-build.yaml +++ b/.github/workflows/docs-build.yaml @@ -32,9 +32,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ env.PYTHON_VERSION }} - name: Bootstrap poetry (Linux and macOS) @@ -55,7 +55,7 @@ jobs: sudo find _build -name .doctrees -prune -exec rm -rf {} \; sudo find _build -name .buildinfo -exec rm {} \; - name: Upload HTML - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: html-build-artifact path: _build/docs @@ -70,7 +70,7 @@ jobs: echo ${{ github.event.action }} > ./pr/action.txt - name: Upload PR information if: github.event_name == 'pull_request' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: pr path: pr/ @@ -80,7 +80,7 @@ jobs: needs: [build-docs] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: ref: "gh-pages" - name: Initialize Git configuration @@ -88,7 +88,7 @@ jobs: git config user.name docs-build git config user.email do-not-send@github.com - name: Download artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v7 with: name: html-build-artifact path: ${{ github.ref_name }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3b040ce9bb..f0a3d4c6d1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,10 +17,10 @@ jobs: name: Lint Code runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ env.PYTHON_VERSION }} diff --git a/.github/workflows/publish-pypi-approval.yml b/.github/workflows/publish-pypi-approval.yml index 097a26883d..89f202709a 100644 --- a/.github/workflows/publish-pypi-approval.yml +++ b/.github/workflows/publish-pypi-approval.yml @@ -43,7 +43,7 @@ jobs: fi - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: ref: ${{ steps.version.outputs.tag }} fetch-depth: 0 @@ -59,7 +59,7 @@ jobs: echo "✅ Version validated: $VERSION_IN_FILE matches tag $TAG_VERSION" - name: Download artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v7 with: name: ${{ steps.version.outputs.artifact_name }} path: dist diff --git a/.github/workflows/publish-wheel.yml b/.github/workflows/publish-wheel.yml index ac6d33664b..803d131914 100644 --- a/.github/workflows/publish-wheel.yml +++ b/.github/workflows/publish-wheel.yml @@ -12,12 +12,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: '3.11' - name: Download artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v7 with: name: nemoguardrails-${{ github.event.inputs.version }}.whl diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 72edb8316d..04950085a4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,13 +26,13 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: "3.10" diff --git a/.github/workflows/test-and-build-wheel.yml b/.github/workflows/test-and-build-wheel.yml index a926ece7e2..1d884a092a 100644 --- a/.github/workflows/test-and-build-wheel.yml +++ b/.github/workflows/test-and-build-wheel.yml @@ -19,10 +19,10 @@ jobs: outputs: artifact_name: ${{ steps.set-artifact-name.outputs.artifact_name }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ env.PYTHON_VERSION }} @@ -75,7 +75,7 @@ jobs: fi - name: Upload Build Artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: ${{ steps.set-artifact-name.outputs.artifact_name }} path: dist/* @@ -88,12 +88,12 @@ jobs: python-version: ["3.10", "3.11", "3.12", "3.13"] steps: - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} - name: Download Build Artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v7 with: name: ${{ needs.build-wheel.outputs.artifact_name }} diff --git a/.github/workflows/test-docker.yml b/.github/workflows/test-docker.yml index 69fb9c22a7..4172725355 100644 --- a/.github/workflows/test-docker.yml +++ b/.github/workflows/test-docker.yml @@ -24,7 +24,7 @@ jobs: # # Checkout the code - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 # Get runner architecture - name: Get runner architecture diff --git a/.github/workflows/test-published-dist.yml b/.github/workflows/test-published-dist.yml index 2103376bba..a63f06c36e 100644 --- a/.github/workflows/test-published-dist.yml +++ b/.github/workflows/test-published-dist.yml @@ -12,7 +12,7 @@ jobs: python-version: ["3.10", "3.11", "3.12", "3.13"] steps: - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} diff --git a/nemoguardrails/server/schemas/utils.py b/nemoguardrails/server/schemas/utils.py index a37928d84e..900daea16c 100644 --- a/nemoguardrails/server/schemas/utils.py +++ b/nemoguardrails/server/schemas/utils.py @@ -140,16 +140,11 @@ async def fetch_models( headers: Dict[str, str] = {} forwarded = request_headers.get("Authorization", "") - # Check if the auth header is a Bearer token - if forwarded and auth_header_name == "Authorization": - headers["Authorization"] = forwarded - else: - # Extract the key from the forwarded header or from the env var. + raw_key = os.environ.get(api_key_env, "") + if not raw_key: raw_key = forwarded.removeprefix("Bearer ").strip() if forwarded else "" - if not raw_key: - raw_key = os.environ.get(api_key_env, "") - if raw_key: - headers[auth_header_name] = f"Bearer {raw_key}" if use_bearer else raw_key + if raw_key: + headers[auth_header_name] = f"Bearer {raw_key}" if use_bearer else raw_key headers.update(provider.get("extra_headers", {}))