Skip to content

Commit 56ee29b

Browse files
askbCopilot
andcommitted
CI: Add gitlint commit-msg pre-commit hook
Wire commit-message linting consistently via the gitlint pre-commit hook and run it from the pre-commit tox env so Jenkins tox-verify exercises it. Aligns with the odlparent/releng-builder pattern. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Change-Id: Ic2887e689dc74ab69c8d9c038c85bbcd2dfe9a11 Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
1 parent 03ac561 commit 56ee29b

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ repos:
2929
args: ["--fix=lf"]
3030
exclude: '^.*\.(bin|patch|diff|xml|XML|yang|YANG)$'
3131

32+
- repo: https://github.com/jorisroovers/gitlint
33+
rev: acc9d9de6369b76d22cb4167029d2035e8730b98 # frozen: v0.19.1
34+
hooks:
35+
- id: gitlint
36+
3237
- repo: https://github.com/Lucas-C/pre-commit-hooks
3338
rev: a30f0d816e5062a67d87c8de753cfe499672b959 # frozen: v1.5.5
3439
hooks:

tox.ini

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
[tox]
22
minversion = 1.6.0
3-
envlist = docs
3+
envlist = docs pre-commit
44
skipsdist = true
55

66
[testenv:docs]
77
deps = -rdocs/requirements.txt
88
commands = sphinx-build -W -n -b html -d {envtmpdir}/doctrees ./docs/ {envtmpdir}/html
9+
10+
[testenv:pre-commit]
11+
basepython = python3
12+
deps = pre-commit
13+
commands =
14+
pre-commit run --all-files
15+
pre-commit run gitlint --hook-stage commit-msg --commit-msg-filename .git/COMMIT_EDITMSG

0 commit comments

Comments
 (0)