A plug-in that integrates git hooks with devbox, particularly useful for running a pre-commit
script defined in
devbox.
Add "github:joeapearson/devbox-git-hooks"
to your devbox.json include
list.
- Add a script to your devbox.json
shell.scripts
map matching the name of the git hook you'd like to invoke devbox. For example,"pre-commit"
,"post-commit"
and so on. .git/hooks
will be checked for an existing hook. If one exists, it'll be left unmodified.- If not already existing, a hook will be created, pointing to
devbox run HOOK_NAME
More information on git hooks is found here.
- Remove the entry from
shell.scripts
. - Check and delete the associated
.git/hooks/HOOK_NAME
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.7/.schema/devbox.schema.json",
"packages": ["shellcheck@latest"],
"shell": {
"scripts": {
"pre-commit": ["shellcheck *.sh"]
}
},
"include": ["github:joeapearson/devbox-git-hooks"]
}
Demonstrates how you might use shellcheck to lint shell scripts before committing changes.
If CI
environment variable is set then this plug-in does nothing.