Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add invalidate-cache flag #6949

Merged
merged 1 commit into from
Jun 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .github/actions/pyenv/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ inputs:
description: 'The path to requirements.txt file'
required: false

invalidate-cache:
default: 'false'
description: 'Force create a virtualenv'
required: false

outputs:
virtualenv-directory:
description: 'The path to the restored or created virtualenv'
Expand All @@ -24,13 +29,20 @@ runs:
python-version: ${{inputs.python-version}}

- name: Restore virtual env
uses: syphar/restore-virtualenv@v1
uses: drew2a/restore-virtualenv@v1.2.1
id: cache-virtualenv
with:
requirement_files: ${{inputs.requirements}}

- name: Invalidate cache
if: inputs.invalidate-cache == 'true'
shell: bash
run: |
rm -rf ${{steps.cache-virtualenv.outputs.virtualenv-directory}}
python -m venv ${{steps.cache-virtualenv.outputs.virtualenv-directory}}

- name: Install pip dependencies
if: steps.cache-virtualenv.outputs.cache-hit != 'true'
if: steps.cache-virtualenv.outputs.cache-hit != 'true' || inputs.invalidate-cache == 'true'
shell: bash
run: |
python -m pip install --upgrade pip
Expand Down