webgriffe / captainhook
Provides some useful custom actions to be used with Captain Hook (a PHP GIT hooks library)
Installs: 95 760
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 0
Open Issues: 1
Requires
- php: ^7.2 || ^8.0
- ext-posix: *
- captainhook/captainhook: ^5.0
- sebastianfeldmann/git: ^3.1
Requires (Dev)
- phpspec/phpspec: ^6.3
This package is auto-updated.
Last update: 2024-10-28 15:38:46 UTC
README
A collection of useful conditions and actions to be used with CaptainHook.
Install
Given that you already have CaptainHook in your project you can simply use Composer to have these webgriffe/captainhook
actions available:
composer require --dev webgriffe/captainhook
Actions
Here follows the list of implemented actions.
1. Prevent forced push on protected branches
For example, you can prevent forced push on master
branch with the following CaptainHook's config:
// captainhook.json // ... "pre-push": { "enabled": true, "actions": [ { "action": "\\Webgriffe\\CaptainHook\\PreventPushForce", "options": {"protected-branches": ["master"]} } ] } // ...
You can use the protected-branches
option to add other branches to the protected branches list.
2. Prevent commit if the diff is included in the message
// captainhook.json // ... "commit-msg": { "enabled": true, "actions": [ { "action": "\\Webgriffe\\CaptainHook\\PreventCommitMessageWithDiff" } ] }, // ...
3. Prevent commit if some files have the same name but different case
// captainhook.json // ... "commit-msg": { "enabled": true, "actions": [ { "action": "\\Webgriffe\\CaptainHook\\PreventCommitCaseSensitiveSameFilename" } ] }, // ...
License
This library is under the MIT license. See the complete license in the LICENSE file.
Credits
Developed by Webgriffe®.