Skip to content

Commit e3452ea

Browse files
committed
ci(pre-commit): Properly cache python modules
1 parent 030daa4 commit e3452ea

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

.github/workflows/pre-commit.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
- name: Set up Python 3
2929
uses: actions/setup-python@v5
3030
with:
31+
cache-dependency-path: tools/pre-commit/requirements.txt
32+
cache: 'pip'
3133
python-version: "3.x"
3234

3335
- name: Get Python version hash
@@ -41,11 +43,10 @@ jobs:
4143
with:
4244
path: |
4345
~/.cache/pre-commit
44-
~/.cache/pip
45-
key: pre-commit|${{ env.PY_HASH }}|${{ hashFiles('.pre-commit-config.yaml', '.github/workflows/pre-commit.yml') }}
46+
key: pre-commit-${{ env.PY_HASH }}-${{ hashFiles('.pre-commit-config.yaml', '.github/workflows/pre-commit.yml', 'tools/pre-commit/requirements.txt') }}
4647

4748
- name: Install python dependencies
48-
run: python -m pip install pre-commit docutils
49+
run: python -m pip install -r tools/pre-commit/requirements.txt
4950

5051
- name: Get changed files
5152
id: changed-files
@@ -61,7 +62,6 @@ jobs:
6162
with:
6263
path: |
6364
~/.cache/pre-commit
64-
~/.cache/pip
6565
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
6666

6767
- name: Push changes using pre-commit-ci-lite

tools/pre-commit/requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pre-commit==3.7.1
2+
docutils==0.21.2

0 commit comments

Comments
 (0)