mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-11 19:56:03 +00:00
Make uv-lock pre-commit hook smart about release branches by wrapping it in a script that detects release branches and sets UV_EXTRA_INDEX_URL. This allows the same pre-commit config to work locally and in CI without special environment variable setup in workflows. Changes: - Add scripts/pre-commit-uv-lock.sh wrapper that detects release branches - Move uv-lock from astral-sh/uv-pre-commit to local hook using wrapper - Remove UV env var setup from pre-commit workflow (hook handles it) - Regenerate uv.lock with test.pypi as extra index (not primary)
22 lines
697 B
Bash
Executable file
22 lines
697 B
Bash
Executable file
#!/bin/bash
|
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
# All rights reserved.
|
|
#
|
|
# This source code is licensed under the terms described in the LICENSE file in
|
|
# the root directory of this source tree.
|
|
|
|
set -euo pipefail
|
|
|
|
# Detect current branch
|
|
BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")
|
|
|
|
# On release branches, use test.pypi as extra index for RC versions
|
|
if [[ "$BRANCH" =~ ^release-[0-9]+\.[0-9]+\.x$ ]]; then
|
|
echo "Detected release branch: $BRANCH"
|
|
echo "Setting UV_EXTRA_INDEX_URL=https://test.pypi.org/simple/"
|
|
export UV_EXTRA_INDEX_URL="https://test.pypi.org/simple/"
|
|
export UV_INDEX_STRATEGY="unsafe-best-match"
|
|
fi
|
|
|
|
# Run uv lock
|
|
exec uv lock "$@"
|