Skip to content

Commit b58f7a1

Browse files
authored
Merge pull request #37 from cisagov/add_python_version_to_cache_keys
Incorporate the Python version into keys for pip and pre-commit caches.
2 parents c7f339f + 454864b commit b58f7a1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

.github/workflows/build.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,25 @@ jobs:
1414
- uses: actions/setup-python@v1
1515
with:
1616
python-version: 3.8
17+
- name: Store installed Python version
18+
run: |
19+
echo "::set-env name=PY_VERSION::"\
20+
"$(python -c "import platform;print(platform.python_version())")"
1721
- name: Cache pip test requirements
1822
uses: actions/cache@v1
1923
with:
2024
path: ~/.cache/pip
21-
key: "${{ runner.os }}-pip-test-\
25+
key: "${{ runner.os }}-pip-test-py${{ env.PY_VERSION }}-\
2226
${{ hashFiles('**/requirements-test.txt') }}"
2327
restore-keys: |
28+
${{ runner.os }}-pip-test-py${{ env.PY_VERSION }}-
2429
${{ runner.os }}-pip-test-
2530
${{ runner.os }}-pip-
2631
- name: Cache pre-commit hooks
2732
uses: actions/cache@v1
2833
with:
2934
path: ~/.cache/pre-commit
30-
key: "${{ runner.os }}-pre-commit-\
35+
key: "${{ runner.os }}-pre-commit-py${{ env.PY_VERSION }}-\
3136
${{ hashFiles('**/.pre-commit-config.yaml') }}"
3237
- name: Install dependencies
3338
run: |

0 commit comments

Comments
 (0)