Skip to content

Commit

Permalink
BUILD/MINOR: ci: add spell check to commit messages to check mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
oktalz committed Aug 20, 2024
1 parent 0587d45 commit db6f407
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 2 deletions.
21 changes: 21 additions & 0 deletions .aspell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
mode: commit
min_length: 3
ignore:
- '*_test.go'
allowed:
- aspell
- repo
- yaml
- config
- Github
- Gitlab
- env
- failsafe
- golang
- mkdir
- WORKDIR
- apk
- ENTRYPOINT
- ubuntu
- golangci
- sudo
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ kubernetes-ingress
dist/
.code-generator/
bin/golangci-lint
bin/check-commit
.local/*
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ golangci_lint:
- go
script:
- make lint
lint-commit-msg:
commit-policy:
stage: lint
needs: []
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
image:
name: $CI_REGISTRY_GO/commit-check:3.0.0
name: $CI_REGISTRY_GO/commit-check:5.0.2
entrypoint: [""]
tags:
- go
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ TARGETPLATFORM?=linux/amd64
GOOS?=linux
GOARCH?=amd64
GOLANGCI_LINT_VERSION=1.59.1
CHECK_COMMIT=5.0.2

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

.PHONY: check-commit
check-commit:
cd bin;CHECK_COMMIT=${CHECK_COMMIT} sh check-commit.sh
check-commit

.PHONY: yaml-lint
yaml-lint:
docker run --rm -v $(pwd):/data cytopia/yamllint .
Expand Down
9 changes: 9 additions & 0 deletions bin/check-commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
V=$(./check-commit tag)

if echo "$V" | grep -q "v$CHECK_COMMIT"; then
echo "$V"
else
echo "go install github.com/haproxytech/check-commit/v5@v$CHECK_COMMIT"
GOBIN=$(pwd) go install github.com/haproxytech/check-commit/v5@v$CHECK_COMMIT
fi

0 comments on commit db6f407

Please sign in to comment.