Skip to content

Commit

Permalink
adds an option to only check changed docs (#5028)
Browse files Browse the repository at this point in the history
Signed-off-by: Wiard van Rij <wiard@outlook.com>
  • Loading branch information
wiardvanrij authored Jan 5, 2022
1 parent 2f82d46 commit f2628ce
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ include .busybox-versions

FILES_TO_FMT ?= $(shell find . -path ./vendor -prune -o -name '*.go' -print)
MD_FILES_TO_FORMAT = $(shell find docs -name "*.md") $(shell find examples -name "*.md") $(filter-out mixin/runbook.md, $(shell find mixin -name "*.md")) $(shell ls *.md)
FAST_MD_FILES_TO_FORMAT = $(shell git diff --name-only | grep ".md")

DOCKER_IMAGE_REPO ?= quay.io/thanos/thanos
DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))-$(shell date +%Y-%m-%d)-$(shell git rev-parse --short HEAD)
Expand Down Expand Up @@ -218,6 +219,12 @@ docs: build examples $(MDOX)
@echo ">> generating docs"
PATH="${PATH}:$(GOBIN)" $(MDOX) fmt -l --links.localize.address-regex="https://thanos.io/.*" --links.validate.config-file=$(MDOX_VALIDATE_CONFIG) $(MD_FILES_TO_FORMAT)

.PHONY: changed-docs
changed-docs: ## Only do the docs check for files that have been changed (git status)
changed-docs: build examples $(MDOX)
@echo ">> generating docs on changed files"
PATH="${PATH}:$(GOBIN)" $(MDOX) fmt -l --links.localize.address-regex="https://thanos.io/.*" --links.validate.config-file=$(MDOX_VALIDATE_CONFIG) $(FAST_MD_FILES_TO_FORMAT)

.PHONY: check-docs
check-docs: ## checks docs against discrepancy with flags, links, white noise.
check-docs: build examples $(MDOX)
Expand Down

0 comments on commit f2628ce

Please sign in to comment.