This commit is contained in:
hoangvv 2025-01-10 09:32:52 +07:00
parent 32fe20fe6a
commit 4ac226192a
2 changed files with 18 additions and 1 deletions

View File

@ -20,7 +20,7 @@ jobs:
with:
ref: ${{ github.ref_name }}
- name: Create Virtual Environment
run: pyenv virtualenv "$(git rev-parse --short "$GITHUB_SHA")"
run: /home/nextzen/.pyenv/bin/pyenv virtualenv "${{ github.ref_name }}-$(git rev-parse --short "$GITHUB_SHA")"
- name: Install dotenv
run: pip install python-dotenv

17
setup/clean_up_virtualenvs.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
# Get the current branch name
branch_name=$(git rev-parse --abbrev-ref HEAD)
# Get a list of all virtual environments, filtering out duplicates
virtualenvs=$(pyenv virtualenvs | awk '{print $1}' | sort -u)
# Loop through each virtual environment and delete it if it contains the branch name
for venv in $virtualenvs; do
if [[ "$venv" == *"$branch_name"* ]]; then
echo "Deleting virtual environment: $venv"
pyenv virtualenv-delete "$venv" -f
fi
done
echo "Virtual environments containing '$branch_name' deleted."