goreadme
goreadme copied to clipboard
Add pre-commit support
pre-commit is "A framework for managing and maintaining multi-language pre-commit hooks", so kinda like a local CI. It's a popular tool with a lot of community-made hooks. I thought it would be very handy to have pre-commit support in goreadme, allowing to rewrite the readme each time the doc is changed, even before pushing.
The PR only consists of a new file used by pre-commit, and the new instructions in README. It has no impact on goreadme itself.
I tested it on a private repo and it works well.
I just added a commit making the "Use as a command line tool" sentence a header too, since it was currently included in the "GitHub Action" section, which felt wrong. Let me know if that doesn't seem right to you.
Btw, a little off-topic, but shouldn't it be updated to go install github.com/posener/goreadme/cmd/goreadme@latest
?
Sorry for the late reply.
This is cool.
I have no objection to add it.
Is there any way to test the integration?
Hi, thanks for the reply!
I just created a demo repo, here: https://github.com/alexandregv/goreadme-precommit-demo I pushed a main.go file with some sample Go doc, but I voluntarily skipped the pre-commit run, so you can do it yourself.
- Install pre-commit: https://pre-commit.com/#install
- Clone the demo repo
- In the cloned repo, run
pre-commit install
(to register the hooks in.git/hooks/
) - Modify the main.go file so you can commit it
- Commit, see the pre-commit logs
- Check the modified README ! It should now contain the go doc info I skipped earlier.
You can also force-run pre-commit at all times with pre-commit run --all-files
.
Looks good. Thanks for the contribution.