Skip to content

Releases: captainhookphp/captainhook

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

5.16.0

24 Mar 09:49
5.16.0
b349a2e
Compare
Choose a tag to compare

Changes

  • Add issue key injection action
  • Add new file condition
  • Skip all hooks in CI environments
  • Fix PrepareFromFile action

The new condition allows to extract issue keys from branch names and append or prepend the key to the commit message subject or body.

The following example will extract JIRA issue keys and append them at the end of the commit message.

{
  "action": "\\CaptainHook\\App\\Hook\\Message\\Action\\InjectIssueKeyFromBranch"
    "options": {
      "regex": "#([A-Z]+\\-[0-9]+)#i",
      "into": "body",
      "mode": "append",
      "prefix": "\\n\\nIssue: "
  }
}

Commit message before

This is some nice change

This is a more thorough description of what was changed
so people can understand why the change was done this way.

Commit message after

This is some nice change

This is a more thorough description of what was changed
so people can understand why the change was done this way.

Issue: PROJKEY-1234567

5.15.6

23 Mar 11:33
5.15.6
9dd1c57
Compare
Choose a tag to compare

Changes

  • BUGFIX: Don't overwrite externally changed msg file
  • Improved output

Using CLI actions to prepare commit messages did not work because of an afterAction issue.
The issue was fixed and you can now prepare a commit message with any CLI command.

5.15.5

20 Mar 10:37
5.15.5
7fb1c78
Compare
Choose a tag to compare

Changes

  • Add --only-enabled option to installer (by Matthieu CODRON)

5.15.4

18 Mar 16:15
5.15.4
935d8f4
Compare
Choose a tag to compare

Changes

  • Add CHANGED_FILES placeholder
  • Allow all usage of all ChangedFile Conditions within pre-push hooks

5.15.3

16 Mar 21:51
5.15.3
c97b9ee
Compare
Choose a tag to compare

Changes

  • Add protected branches option to BlockFixupAndSquashCommits Action
  • Allowed passing multiple hooks for installation (hook argument) via comma (by Olexandr Mazur)