Releases: captainhookphp/captainhook
5.18.1
Changes
- Fix PHAR build
5.18.0
Changes
If you use Docker to execute the captain until now you could run into problems by using git commit -a
.
The reason being that git uses an environment variable to configure the index file to use.
The command git commit -a
creates a new index file with everything in in it not changing your original index before the command succeeds.
So for this to work, the GIT_INDEX_FILE
environment variable hat to be forwarded to the Docker container. And more, since the variable contains the path to the index file the path had to be mapped from the host system path to the container path.
This is now all done by the Capn, but only if you specify the
run-gitconfig value with the path to the
.git` directory within your container.
Here is an example configuration:
{
"config": {
"run": {
"mode": "docker",
"exec": "docker exec my-container",
"path": "vendor/bin/captainhook",
"git": "/docker/mx-project/.git"
}
}
...
}
For hooks that could need the environment variable like pre-commit
this will result in Docker command like this:
docker exec -i -e GIT_INDEX_FILE=/docker/my-project/.git/($GIT_INDEX_FILE) my-container vendor/bin/captainhook ...
So from version 5.18.0 the Cap`n tries to optimize you docker commands. If you run in any problems let me know.
5.17.3
Changes
- OfType now allows multiple types
- Fix new
ConfigAware
related issues - Sanitize diff filter arguments
- Add example config to PHPDoc
5.17.2
5.17.1
Changes
- Activate the uninstall command for real 🤦
5.17.0
Changes
- Optimize docker command
- Add uninstall command
- Allow diff filter setting for conditions
- Add php 8.3 support
- Allow run-path to overwrite absolute path
- Decrease action json footprint
If the Cap'n detects a docker exec command
it will make sure the --interactive
flag is set.
Normally I would add --tty
if necessary as well but committing from any Jetbrains IDE would not work then so I disabled the improvement for now.
You can run captainhook uninstall
to remove all scripts from .git/hooks/
.
You can use Diff filters for StagedFile
conditions as well, in case you only want do check the code style for new files.
"action": "phpcs --colors --standard=psr12 {$STAGED_FILES|of-type:php|separated-by: |diff-filter:A}",
"conditions": [
{"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileStaged\\OfType",
"args": [
"php",
["A"]
]}
]
What's Changed
- Feature/use run path as is by @sebastianfeldmann in #221
- Allow diff filter setting for conditions by @sebastianfeldmann in #222
- Decrease action json footprint by @sebastianfeldmann in #223
- Add uninstall command to the Cap'n by @sebastianfeldmann in #224
- Add PHP 8.3 build (experimental) by @sebastianfeldmann in #225
- Add some necessary onions to docker exec by @sebastianfeldmann in #226
Full Changelog: 5.16.4...5.17.0
5.16.4
Changes
- Add label functionality
- Allow
ThatIs
condition to take multivalued options (by Matthieu CODRON)
Actions can be configured with a label that will enhance the output.
{
"action": "\\CaptainHook\\App\\Hook\\Message\\Action\\Beams",
"options": {
"subjectLength": 50,
"bodyLineLength": 72
},
"config": {
"label": "Verify commit message format"
}
}
Will output
commit-msg:
- Verify commit message format : done
5.16.3
Changes
- Fix broken git dependency
5.16.2
Changes
- Add diff filter to conditions
- Fix test coverage
5.16.1
Changes
- Make sure to not add empty lines at the beginning of message subject or body