Husky commands to check that commits are tied to Pivotal Tracker stories.
npm install husky husky-pivotal --save-dev
Then add the hook commands to your project's package.json, via the "scripts" field:
"scripts": {
"commitmsg": "hup-ckmsg",
"precommit": "hup-ckbranch",
"preparecommitmsg": "hup-mkmsg"
}
You can pick and choose the hook commands most appropriate to your project and preferences.
Several hook commands are included with this package:
Hook | Command | Description |
---|---|---|
preparecommitmsg |
hup-mkmsg |
Looks for a story ID in the current branch name and then uses it to prefill commit messages with a [#____] format story reference. |
commitmsg |
hup-ckmsg |
Ensures that the commit message contains a [#____] format story reference; aborts the commit if not. |
precommit |
hup-ckbranch |
Ensures that the current branch name contains a Pivotal Tracker story ID; aborts the commit if not. |
You may not want to use every one of these commands: simply omit the ones you don't want from your npm scripts.