Cache Python dependencies in pre-commit workflow
This should speed up installation of pre-commit as part of the Gitea Action a bit, as it caches the Python packages required for it. The cache functionality of actions/setup-python is unsuitable for this use case, as we don't have a file with requirements we want to use as key. Instead, we just want to cache whatever is downloaded via pip from PyPI and keep it for further invocations. This commit achieves that by using the same cache key for every workflow run. The cache is being updated even if pre-commit fails so we always keep the the Python packages used for installing pre-commit cached.
This commit is contained in:
parent
97e6691c76
commit
0feeb5884a
@ -9,4 +9,14 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
|
- id: restore-pip-cache
|
||||||
|
uses: actions/cache/restore@v4
|
||||||
|
with:
|
||||||
|
key: pip-cache-v1-${{ github.workflow }}
|
||||||
|
path: ~/.cache/pip
|
||||||
- uses: pre-commit/action@v3.0.1
|
- uses: pre-commit/action@v3.0.1
|
||||||
|
- uses: actions/cache/save@v4
|
||||||
|
if: steps.restore-pip-cache.outcome == 'success'
|
||||||
|
with:
|
||||||
|
key: pip-cache-v1-${{ github.workflow }}
|
||||||
|
path: ~/.cache/pip
|
||||||
|
Loading…
Reference in New Issue
Block a user