Skip to content

How to use the "Cli" condition in the hooks ? #176

Discussion options

You must be logged in to vote

To use a cli command for a condition all you have to do is to put the command in the exec part of the configuration.
The Cap'n will automatically detect that it has to execute a CLI command and will setup the Cli action automatically, you don't have to do that manually.
The only thing your command has to do is to exit with code 0 if the condition should apply and anything else if the condition should not apply.

{
  "commit-msg": {
    "enabled": true,
    "actions": [
      {
        "action": "\\CaptainHook\\App\\Hook\\Message\\Action\\Regex",
        "options": {
          "regex": "#^(TICKET)-[1-9][0-9]* #",
          "error": "No match for: %s",
          "success": "Found match: %s"
…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@vasilake-v
Comment options

Answer selected by vasilake-v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants