Skip to content

Commit 533e558

Browse files
committed
fix(precommit): validate current commit message instead of previous
1 parent fdf478e commit 533e558

File tree

12 files changed

+20270
-12
lines changed

12 files changed

+20270
-12
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44

55
/lib/cli/index.js linguist-generated=true
66
/lib/action/index.js linguist-generated=true
7+
/lib/precommit/index.js linguist-generated=true

.pre-commit-hooks.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
- id: commit-me
55
name: CommitMe - Conventional Commit message validation
66
description: Validates your commits agains the Conventional Commits specification
7-
entry: commit-me
7+
entry: pre-commit-me
88
language: node
9-
args: ['check', '--base-branch', 'HEAD~1']
10-
always_run: true
9+
stages: [commit-msg]

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ CommitMe provides a [Pre-commit hook](#pre-commit), [GitHub Action](#cicd-valida
1717

1818
## Pre-commit hook
1919

20-
You can add CommitMe as a [pre-commit](https://pre-commit.com) by including it in your `.pre-commit.config.yaml` file, e.g.:
20+
You can add CommitMe as a [pre-commit](https://pre-commit.com) by:
21+
22+
1. [Installing pre-commit](https://pre-commit.com/#install)
23+
2. Including CommitMe in your `.pre-commit.config.yaml` file, e.g.:
2124

2225
```yaml
2326
repos:
@@ -26,8 +29,10 @@ repos:
2629
hooks:
2730
- id: commit-me
2831
```
29-
30-
> **NOTE**: The pre-commit hook will **IGNORE** empty commits (`git commit --allow-empty [...]`).
32+
3. Installing the `commit-msg` hooks
33+
```
34+
$ pre-commit install --hook-type commit-msg
35+
```
3136
3237
## CICD Validation (GitHub Action)
3338

bin/pre-commit-me

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env node
2+
3+
// SPDX-FileCopyrightText: 2023 Kevin de Jong <monkaii@hotmail.com>
4+
// SPDX-License-Identifier: GPL-3.0-or-later
5+
6+
require('../lib/precommit/index.js');

lib/action/index.js

Lines changed: 19 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/cli/index.js

Lines changed: 19 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)