Skip to content
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "library",
"description": "PHP git hook manager",
"keywords": ["git", "hooks", "pre-commit", "pre-push", "commit-msg", "prepare-commit-msg", "post-merge"],
"homepage": "http://php.captainhook.info/",
"homepage": "https://php.captainhook.info/",
"license": "MIT",
"authors": [
{
Expand Down
20 changes: 10 additions & 10 deletions src/Hook/Branch/Action/BlockFixupAndSquashCommits.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@
* This action blocks pushes that contain fixup! or squash! commits.
* Just as a security layer, so you are not pushing stuff you wanted to autosquash.
*
* Configure like this:
*
* Example configuration:
* <code>
* {
* "action": "\\CaptainHook\\App\\Hook\\Branch\\Action\\BlockFixupAndSquashCommits",
* "options": {
* "blockSquashCommits": true,
* "blockFixupCommits": true,
* "protectedBranches": ["main", "master", "integration"]
* },
* "conditions": []
* }
* "action": "CaptainHook.Branch.PreventPushOfFixupAndSquashCommits",
* "options": {
* "blockSquashCommits": true,
* "blockFixupCommits": true,
* "protectedBranches": ["main", "master", "integration"]
* }
* }
* </code>
*
* @package CaptainHook
* @author Sebastian Feldmann <[email protected]>
Expand Down
14 changes: 14 additions & 0 deletions src/Hook/Branch/Action/EnsureNaming.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@
/**
* Class EnsureNaming
*
* This Action makes sure you are on a branch that follows your naming conventions.
*
* Example configuration:
* <code>
* {
* "action": "CaptainHook.Branch.EnsureNaming",
* "options": {
* "regex": "#feature/issue[0-9]+-.*#i",
* "error": "Arr matey! Ye be on the wrong branch!",
* "success": "All clear, Captain! Full speed ahead!",
* }
* }
* </code>
*
* @package CaptainHook
* @author Felix Edelmann <[email protected]>
* @link https://github.com/captainhook-git/captainhook
Expand Down
15 changes: 14 additions & 1 deletion src/Hook/Condition/Branch/NotOn.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,20 @@
use SebastianFeldmann\Git\Repository;

/**
* NotOn condition
* NotOn Branch condition
*
* Example configuration:
* <code>
* {
* "action": "some-action",
* "conditions": [
* {
* "exec": "CaptainHook.Status.NotOnBranch",
* "args": ["not-on-this-branch"]
* }
* ]
* }
* </code>
*
* @package CaptainHook
* @author Sebastian Feldmann <[email protected]>
Expand Down
15 changes: 14 additions & 1 deletion src/Hook/Condition/Branch/NotOnMatching.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,20 @@
use SebastianFeldmann\Git\Repository;

/**
* NotOnMatching condition
* NotOnMatching Branch condition
*
* Example configuration:
* <code>
* {
* "action": "some-action",
* "conditions": [
* {
* "exec": "CaptainHook.Status.NotOnMatchingBranch",
* "args": ["#^branches-names/not-matching[0-9]+-this-regex$#i"]
* }
* ]
* }
* </code>
*
* @package CaptainHook
* @author Sebastian Feldmann <[email protected]>
Expand Down
15 changes: 14 additions & 1 deletion src/Hook/Condition/Branch/On.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,20 @@
use SebastianFeldmann\Git\Repository;

/**
* On condition
* On Branch condition
*
* Example configuration:
* <code>
* {
* "action": "some-action",
* "conditions": [
* {
* "exec": "CaptainHook.Status.OnBranch",
* "args": ["only-on-this-branch"]
* }
* ]
* }
* </code>
*
* @package CaptainHook
* @author Sebastian Feldmann <[email protected]>
Expand Down
15 changes: 14 additions & 1 deletion src/Hook/Condition/Branch/OnMatching.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,20 @@
use SebastianFeldmann\Git\Repository;

/**
* OnMatching condition
* OnMatching Branch condition
*
* Example configuration:
* <code>
* {
* "action": "some-action",
* "conditions": [
* {
* "exec": "CaptainHook.Status.OnMatchingBranch",
* "args": ["#^branches-names/matching[0-9]+-this-regex$#i"]
* }
* ]
* }
* </code>
*
* @package CaptainHook
* @author Sebastian Feldmann <[email protected]>
Expand Down
25 changes: 17 additions & 8 deletions src/Hook/Condition/Config/CustomValueIsFalsy.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,31 @@
use SebastianFeldmann\Git\Repository;

/**
* Class CustomValueIsFalsy
* Condition CustomValueIsFalsy
*
* With this condition, you can check if a given custom value is falsy.
* The Action only is executed if the custom value is falsy.
* Values considered falsy are, 0, null, empty string, empty array and false.
*
* Example configuration:
*
* "action": "some-action"
* "conditions": [
* {"exec": "\\CaptainHook\\App\\Hook\\Condition\\Config\\CustomValueIsFalsy",
* "args": [
* "NAME_OF_CUSTOM_VALUE"
* ]}
* ]
* <code>
* {
* "action": "some-action"
* "conditions": [
* {
* "exec": "CaptainHook.Config.CustomValueIsFalsy",
* "args": ["NAME_OF_CUSTOM_VALUE"]
* }
* ]
* }
* </code>
*
* @package CaptainHook
* @author Sebastian Feldmann <[email protected]>
* @link https://github.com/captainhook-git/captainhook
* @since Class available since Release 5.17.2
* @short CaptainHook.Config.CustomValueIsFalsy
*/
class CustomValueIsFalsy extends Condition\Config
{
Expand Down
18 changes: 11 additions & 7 deletions src/Hook/Condition/Config/CustomValueIsTruthy.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@
*
* Example configuration:
*
* "action": "some-action"
* "conditions": [
* {"exec": "\\CaptainHook\\App\\Hook\\Condition\\Config\\CustomValueIsTruthy",
* "args": [
* "NAME_OF_CUSTOM_VALUE"
* ]}
* ]
* <code>
* {
* "action": "some-action"
* "conditions": [
* {
* "exec": "CaptainHook.Config.CustomValueIsTruthy",
* "args": ["NAME_OF_CUSTOM_VALUE"]
* }
* ]
* }
* </code>
*
* @package CaptainHook
* @author Sebastian Feldmann <[email protected]>
Expand Down
16 changes: 16 additions & 0 deletions src/Hook/Condition/FileChanged/All.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@
* The FileChange condition is applicable for `post-merge` and `post-checkout` hooks.
* It checks if all configured files are updated within the last change set.
*
* Example configuration:
*
* <code>
* {
* "action": "some-action"
* "conditions": [
* {
* "exec": "CaptainHook.FileChanged.All",
* "args": [
* ["list", "of", "files"]
* ]
* }
* ]
* }
* </code>
*
* @package CaptainHook
* @author Sebastian Feldmann <[email protected]>
* @link https://github.com/captainhook-git/captainhook
Expand Down
27 changes: 15 additions & 12 deletions src/Hook/Condition/FileChanged/Any.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,24 @@
* Class Any
*
* The FileChange condition is applicable for `post-merge` and `post-checkout` hooks.
* For example it can be used to trigger an automatic composer install if the composer.json
* or composer.lock file is changed during a checkout or merge.
* For example, it can be used to trigger an automatic composer install if the composer.json
* or `composer.lock` file is changed during a checkout or merge.
*
* Example configuration:
*
* "action": "composer install"
* "conditions": [
* {"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileChange\\Any",
* "args": [
* [
* "composer.json",
* "composer.lock"
* ]
* ]}
* ]
* <code>
* {
* "action": "some-action"
* "conditions": [
* {
* "exec": "CaptainHook.FileChanged.Any",
* "args": [
* ["list", "of", "files"]
* ]
* }
* ]
* }
* </code>
*
* @package CaptainHook
* @author Sebastian Feldmann <[email protected]>
Expand Down
18 changes: 11 additions & 7 deletions src/Hook/Condition/FileChanged/OfType.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@
*
* Example configuration:
*
* "action": "some-action"
* "conditions": [
* {"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileChanged\\OfType",
* "args": [
* "php"
* ]}
* ]
* <code>
* {
* "action": "some-action"
* "conditions": [
* {
* "exec": "CaptainHook.FileChanged.OfType",
* "args": ["php"]
* }
* ]
* }
* </code>
*
* @package CaptainHook
* @author Sebastian Feldmann <[email protected]>
Expand Down
20 changes: 13 additions & 7 deletions src/Hook/Condition/FileStaged/All.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,19 @@
*
* Example configuration:
*
* "action": "some-action"
* "conditions": [
* {"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileStaged\\All",
* "args": [
* ["file1", "file2", "file3"]
* ]}
* ]
* <code>
* {
* "action": "some-action"
* "conditions": [
* {
* "exec": "CaptainHook.FileStaged.All",
* "args": [
* ["list", "of", "files"]
* ]
* }
* ]
* }
* </code>
*
* The file list can also be defined as comma seperated string "file1,file2,file3"
*
Expand Down
16 changes: 11 additions & 5 deletions src/Hook/Condition/FileStaged/Any.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,21 @@
*
* The FileStaged condition is applicable for `pre-commit hooks.
*
* Example configuration:
* Example configuration:
*
* <code>
* {
* "action": "some-action"
* "conditions": [
* {"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileStaged\\Any",
* "args": [
* ["file1", "file2", "file3"]
* ]}
* {
* "exec": "CaptainHook.FileStaged.Any",
* "args": [
* ["list", "of", "files"]
* ]
* }
* ]
* }
* </code>
*
* The file list can also be defined as comma seperated string "file1,file2,file3"
*
Expand Down
18 changes: 11 additions & 7 deletions src/Hook/Condition/FileStaged/InDirectory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@
*
* Example configuration:
*
* "action": "some-action"
* "conditions": [
* {"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileStaged\\InDirectory",
* "args": [
* "src/"
* ]}
* ]
* <code>
* {
* "action": "some-action"
* "conditions": [
* {
* "exec": "CaptainHook.FileStaged.InDirectory",
* "args": ["src"]
* }
* ]
* }
* </code>
*
* @package CaptainHook
* @author Sebastian Feldmann <[email protected]>
Expand Down
Loading