Skip to content

Releases: captainhookphp/captainhook

5.18.1

13 Oct 10:18
5.18.1
cd09c24
Compare
Choose a tag to compare

Changes

  • Fix PHAR build

5.18.0

10 Oct 20:10
5.18.0
7f7b58f
Compare
Choose a tag to compare

Changes

  • Improve run configuration fixes issue #178 big thanks to @renky
  • Improve a bunch of types

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

04 Oct 11:55
5.17.3
cac493c
Compare
Choose a tag to compare

Changes

  • OfType now allows multiple types
  • Fix new ConfigAware related issues
  • Sanitize diff filter arguments
  • Add example config to PHPDoc

5.17.2

03 Oct 12:33
5.17.2
a935975
Compare
Choose a tag to compare

Changes

  • Provide conditions with Config access thanks to @Wirone
  • Ad new conditions Config\CustomValueIsTruthy and Config\CustomValueIsFalsy
  • Update install demo video

5.17.1

02 Oct 08:33
5.17.1
3cb0b14
Compare
Choose a tag to compare

Changes

  • Activate the uninstall command for real 🤦

5.17.0

01 Oct 18:51
5.17.0
d939910
Compare
Choose a tag to compare

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

Full Changelog: 5.16.4...5.17.0

5.16.4

17 Apr 19:50
5.16.4
524c866
Compare
Choose a tag to compare

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

30 Mar 16:41
5.16.3
ed0279f
Compare
Choose a tag to compare

Changes

  • Fix broken git dependency

5.16.2

29 Mar 10:08
5.16.2
8aa6ca6
Compare
Choose a tag to compare

⚠️ this version has a critical bug ⚠️

Changes

  • Add diff filter to conditions
  • Fix test coverage

5.16.1

24 Mar 10:04
5.16.1
ab9091e
Compare
Choose a tag to compare

Changes

  • Make sure to not add empty lines at the beginning of message subject or body