Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add examples for configuring with lefthook #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ npm install --save-dev git-notify
yarn add -D git-notify
```

Next, we'll configure `git-notify` to run automatically when other developers pull commits that contain git messages. Below we show how to achieve this with the excellent [husky](https://github.com/typicode/husky) library. For other approaches, see the [Git Hooks](#git-hooks) section later in this document.
Next, we'll configure `git-notify` to run automatically when other developers pull commits that contain git messages. Below we show how to achieve this with the excellent [husky](https://github.com/typicode/husky) and [lefthook](https://github.com/evilmartians/lefthook#lefthook) libraries. For other approaches, see the [Git Hooks](#git-hooks) section later in this document.

### Installing hooks with husky

Expand Down Expand Up @@ -67,6 +67,34 @@ Configure `git-notify` hooks by adding the following `husky` entries to your `pa

_**Note:** The above instructions below are for [husky v4.x](https://github.com/typicode/husky/tree/master). Husky v5 has changed how hooks are configured, as well updated its licensing terms to be free only to other open source projects.See [husky's own documentation](https://dev.to/typicode/what-s-new-in-husky-5-32g5) for how to configure hooks in their latest version._

### Installing hooks with lefthook

```
# using npm
npm install --save-dev @arkweid/lefthook

# using yarn
yarn add -D @arkweid/lefthook
```

Configure `git-notify` hooks by adding the following entries to your `lefthook.yml`:

```yaml
post-merge:
commands:
notify:
run: "npx git-notify merge {0}"
post-rewrite:
commands:
notify:
run: "npx git-notify merge {0}"
post-checkout:
commands:
notify:
run: "npx git-notify merge {0}"

```

## Configuration

- `git-notify --prefix "@everyone"`
Expand Down Expand Up @@ -167,6 +195,10 @@ Not at the moment, but this should not be difficult to add. See [Contributing](#

See [Installing hooks with husky](#installing-hooks-with-husky) in the Getting Started section.

### Installing with lefthook

See [Installing hooks with lefthook](#installing-hooks-with-lefthook) in the Getting Started section.

### Installing hooks by any other means

`git-notify` is agnostic to however you want to install your git hooks.
Expand Down