diff --git a/.github/workflows/setup_docker.yml b/.github/workflows/setup_docker.yml index 5dee9ce96..b4627cc8b 100644 --- a/.github/workflows/setup_docker.yml +++ b/.github/workflows/setup_docker.yml @@ -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 diff --git a/setup/clean_up_virtualenvs.sh b/setup/clean_up_virtualenvs.sh new file mode 100755 index 000000000..86613e6d8 --- /dev/null +++ b/setup/clean_up_virtualenvs.sh @@ -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." \ No newline at end of file