Can pre-commit hooks (with pre-commit.com) add files to a commit?
My use case: I do work in jupyter notebooks. On commit, I want to generate and git-add an html version of any ipynb
files in the commit.
Eg a commit hook like:
- repo: local
hooks:
- id: nb-as-html
name: nb-as-html
stages: [commit]
language: system
verbose: false
pass_filenames: false
always_run: true
entry: find devtools \( -name \*.ipynb -not -name \*checkpoint.ipynb \) -type f -exec jupyter nbconvert --to HTML {} \;
and add the file somehow to the commit.
How do I do this? Or is pre-commit not intended for this?