Skip to content

Commit 8576000

Browse files
Merge pull request #15 from Devlaner/14-fix-PR-merge-fail
chore: ignores array that skips merge pull reqs
2 parents 9c2071c + 5bd458a commit 8576000

4 files changed

Lines changed: 24 additions & 4 deletions

File tree

.husky/commit-msg

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
#!/usr/bin/env sh
2-
npx --no -- commitlint --edit "$1"
2+
# Same Conventional Commit rules as CI (.github/workflows/ci.yml). On failure Git
3+
# aborts this commit; fix the message and run git commit again.
4+
printf '%s\n' "Commit message: checking (commitlint, verbose)…"
5+
commitlint --verbose --edit "$1"

CONTRIBUTING.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,23 @@ The repo uses `.gitattributes` so text files are stored with **LF**. On Windows,
4141

4242
## Git hooks (Husky)
4343

44-
After `npm ci` at the repo root:
44+
After `npm ci` at the **repository root**, Git uses Husky (`core.hooksPath``.husky/_`). Then:
4545

46-
- **`pre-commit`** runs `npm --prefix apps/ui run typecheck`. Ensure `apps/ui` dependencies are installed so this succeeds.
47-
- **`commit-msg`** runs [Commitlint](https://commitlint.js.org/) with the [Conventional Commits](https://www.conventionalcommits.org/) preset (`@commitlint/config-conventional`).
46+
- **`pre-commit`** runs before the commit is recorded. It runs `npm --prefix apps/ui run typecheck`. Install UI deps (`apps/ui/npm ci`) so this can succeed.
47+
- **`commit-msg`** runs **immediately after** you supply a message—whether from `git commit -m "your subject"` or from the editor. It runs the same [Commitlint](https://commitlint.js.org/) rules as CI ([Conventional Commits](https://www.conventionalcommits.org/) via `@commitlint/config-conventional`), with **`--verbose`** output like the workflow.
48+
49+
If Commitlint fails, **Git does not create the commit**. You will see the errors in your terminal; fix the message and run `git commit` again (no need to wait for CI to discover the problem).
50+
51+
**Hooks not running?** Run `npm ci` (or `npm install`) once at the repo root. If you only install dependencies under `apps/ui`, root Husky never runs and commits will not be checked locally.
4852

4953
To bypass hooks in exceptional cases (not recommended for routine work): `git commit --no-verify`.
5054

55+
**Dry-run a message without committing** (from repo root, after `npm ci`):
56+
57+
```bash
58+
printf '%s\n' 'feat(ui): example valid message' | npx --no -- commitlint --verbose
59+
```
60+
5161
## Commit messages
5262

5363
Use **Conventional Commits**, for example:

commitlint.config.cjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
module.exports = {
22
extends: ["@commitlint/config-conventional"],
3+
ignores: [
4+
(message) => message.startsWith("Merge pull request "),
5+
(message) => message.startsWith("Merge branch "),
6+
(message) => message.startsWith("Merge remote-tracking branch "),
7+
],
38
}
49

deploy/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: clevis
2+
13
services:
24
api:
35
build:

0 commit comments

Comments
 (0)