Based on the answer to How to cache both pre-commit and Hugo I have created netlify-plugin-pre-commit which handles installing pre-commit hooks and caching them (for faster builds when the cache is ‘hot’).
I welcome any comments, issues, or PRs on it’s GitHub repository.
I hope this proves useful.
Be warned, it is currently alpha, although I have started using it.
Hi @danielfdickinson1 this is awsome! Thank’s for sharing this with the community!!
I have written a blog post with more information on using the plugin Netlify pre-commit and other news
One other thing (that I need to add to the post and documentation) is that you need a
requirements.txt that includes
pre-commit so that Netlify’s build auto-installs the needed Python packages:
FYI I’ve issued a new version of the NPM package and have made a GitHub prerelease release as I have solved issues related to
async, as well as a workaround for cache.save omitting empty directories breaks pre-commit on restore · Issue #5030 · netlify/build · GitHub (assuming I was not fooled by the async issues and the workaround isn’t needed, just correctly serializing certain actions).
In any event it now seems to work properly, though it’s still experimental (alpha). Fortunately, I’ve been ‘dogfooding’ else I wouldn’t have realized the issue so quickly.