fix(ci): export UV_INDEX_STRATEGY to current shell before running uv sync

The setup-runner action only exported UV_INDEX_STRATEGY to GITHUB_ENV,
which only affects subsequent GitHub Actions steps. However, uv sync
runs in the same step, so it never saw the UV_INDEX_STRATEGY variable.

While this bug doesn't currently affect main (since UV_EXTRA_INDEX_URL
is only set on release branches), it's a latent bug that should be fixed
to prevent issues if the logic changes in the future.

The fix adds export UV_INDEX_STRATEGY=unsafe-best-match to make it
available in the current shell before running uv commands.
This commit is contained in:
Ashwin Bharambe 2025-11-01 07:46:33 -07:00
parent b2a5428a14
commit 6a3be5724f

View file

@ -29,11 +29,12 @@ runs:
env: env:
UV_EXTRA_INDEX_URL: ${{ steps.client-config.outputs.uv-extra-index-url }} UV_EXTRA_INDEX_URL: ${{ steps.client-config.outputs.uv-extra-index-url }}
run: | run: |
# Export UV env vars to GITHUB_ENV so they persist across steps # Export UV env vars for current step and persist to GITHUB_ENV for subsequent steps
if [ -n "$UV_EXTRA_INDEX_URL" ]; then if [ -n "$UV_EXTRA_INDEX_URL" ]; then
export UV_INDEX_STRATEGY=unsafe-best-match
echo "UV_EXTRA_INDEX_URL=$UV_EXTRA_INDEX_URL" >> $GITHUB_ENV echo "UV_EXTRA_INDEX_URL=$UV_EXTRA_INDEX_URL" >> $GITHUB_ENV
echo "UV_INDEX_STRATEGY=unsafe-best-match" >> $GITHUB_ENV echo "UV_INDEX_STRATEGY=$UV_INDEX_STRATEGY" >> $GITHUB_ENV
echo "Exported UV environment variables for subsequent steps" echo "Exported UV environment variables for current and subsequent steps"
fi fi
echo "Updating project dependencies via uv sync" echo "Updating project dependencies via uv sync"