Skip to content

Commit 44ba319

Browse files
committed
makefile: add check-gitlint target
Add makefile rule to check commits-set with gitlint utility. Uses origin/main as base commit. Signed-off-by: Shachar Sharon <[email protected]>
1 parent 9b9437a commit 44ba319

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

Makefile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ image-push:
102102
$(CONTAINER_CMD) push $(IMG)
103103

104104
# Check the code
105-
.PHONY: check check-golangci-lint check-format check-yaml
105+
.PHONY: check check-golangci-lint check-format check-yaml check-gitlint
106106

107107
check: check-golangci-lint vet check-yaml
108108

@@ -112,6 +112,9 @@ check-golangci-lint: golangci-lint
112112
check-yaml:
113113
$(YAMLLINT_CMD) -c ./.yamllint.yaml ./
114114

115+
check-gitlint: gitlint
116+
$(GITLINT) -C .gitlint --commits origin/main.. lint
117+
115118
# Find or download auxiliary build tools
116119
.PHONY: build-tools golangci-lint yq
117120
build-tools: golangci-lint yq
@@ -135,4 +138,14 @@ ifeq (, $(shell command -v $(YQ) ;))
135138
@echo "yq installed in $(YQ)"
136139
endif
137140

138-
141+
gitlint:
142+
ifeq (, $(shell command -v gitlint ;))
143+
@echo "gitlint not found in PATH, checking $(GOBIN_ALT)"
144+
ifeq (, $(shell command -v $(GOBIN_ALT)/gitlint ;))
145+
@$(call installtool, --gitlint)
146+
@echo "gitlint installed in $(GOBIN_ALT)"
147+
endif
148+
GITLINT=$(GOBIN_ALT)/gitlint
149+
else
150+
GITLINT=$(shell command -v gitlint ;)
151+
endif

0 commit comments

Comments
 (0)