django-planet
July 30, 2022

Caching pre-commit with GitHub Actions

in blog Tobias McNulty
original entry Caching pre-commit with GitHub Actions

When setting up a GitHub Actions workflow for the repo that deploys this site, I noticed the pre-commit action for GitHub Actions is deprecated, and also doesn’t cache the installation of pre-commit itself. As a workaround, you can easily use the package dependency caching in actions/setup-python to cache the pre-commit installation and a custom actions/cache to cache the pre-commit cache itself (~/.cache/pre-commit/). First, update or create requirements.txt with the current version of pre-commit: