Skip to content

Commit db6f407

Browse files
committed
BUILD/MINOR: ci: add spell check to commit messages to check mistakes
1 parent 0587d45 commit db6f407

File tree

5 files changed

+39
-2
lines changed

5 files changed

+39
-2
lines changed

.aspell.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
mode: commit
2+
min_length: 3
3+
ignore:
4+
- '*_test.go'
5+
allowed:
6+
- aspell
7+
- repo
8+
- yaml
9+
- config
10+
- Github
11+
- Gitlab
12+
- env
13+
- failsafe
14+
- golang
15+
- mkdir
16+
- WORKDIR
17+
- apk
18+
- ENTRYPOINT
19+
- ubuntu
20+
- golangci
21+
- sudo

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ kubernetes-ingress
55
dist/
66
.code-generator/
77
bin/golangci-lint
8+
bin/check-commit
89
.local/*

.gitlab-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ golangci_lint:
8787
- go
8888
script:
8989
- make lint
90-
lint-commit-msg:
90+
commit-policy:
9191
stage: lint
9292
needs: []
9393
rules:
9494
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
9595
image:
96-
name: $CI_REGISTRY_GO/commit-check:3.0.0
96+
name: $CI_REGISTRY_GO/commit-check:5.0.2
9797
entrypoint: [""]
9898
tags:
9999
- go

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ TARGETPLATFORM?=linux/amd64
33
GOOS?=linux
44
GOARCH?=amd64
55
GOLANGCI_LINT_VERSION=1.59.1
6+
CHECK_COMMIT=5.0.2
67

78
.PHONY: test
89
test:
@@ -27,6 +28,11 @@ lint:
2728
cd bin;GOLANGCI_LINT_VERSION=${GOLANGCI_LINT_VERSION} sh lint-check.sh
2829
bin/golangci-lint run --timeout 20m --color always --max-issues-per-linter 0 --max-same-issues 0
2930

31+
.PHONY: check-commit
32+
check-commit:
33+
cd bin;CHECK_COMMIT=${CHECK_COMMIT} sh check-commit.sh
34+
check-commit
35+
3036
.PHONY: yaml-lint
3137
yaml-lint:
3238
docker run --rm -v $(pwd):/data cytopia/yamllint .

bin/check-commit.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
V=$(./check-commit tag)
3+
4+
if echo "$V" | grep -q "v$CHECK_COMMIT"; then
5+
echo "$V"
6+
else
7+
echo "go install github.com/haproxytech/check-commit/v5@v$CHECK_COMMIT"
8+
GOBIN=$(pwd) go install github.com/haproxytech/check-commit/v5@v$CHECK_COMMIT
9+
fi

0 commit comments

Comments
 (0)