[CI] Report non-normalized link from docs into docs (#1844)
Co-authored-by: Liudmila Molkova <limolkova@microsoft.com>
This commit is contained in:
parent
55984275dd
commit
96bc9a7360
20
Makefile
20
Makefile
|
|
@ -5,13 +5,14 @@ PWD := $(shell pwd)
|
||||||
# Determine OS & Arch for specific OS only tools on Unix based systems
|
# Determine OS & Arch for specific OS only tools on Unix based systems
|
||||||
OS := $(shell uname | tr '[:upper:]' '[:lower:]')
|
OS := $(shell uname | tr '[:upper:]' '[:lower:]')
|
||||||
ifeq ($(OS),darwin)
|
ifeq ($(OS),darwin)
|
||||||
SED := gsed
|
SED ?= gsed
|
||||||
else
|
else
|
||||||
SED := sed
|
SED ?= sed
|
||||||
endif
|
endif
|
||||||
|
|
||||||
TOOLS_DIR := $(PWD)/internal/tools
|
TOOLS_DIR := $(PWD)/internal/tools
|
||||||
|
|
||||||
|
MARKDOWN_LINK_CHECK_ARG= # pass extra arguments such as --exclude '^http'
|
||||||
MISSPELL_BINARY=bin/misspell
|
MISSPELL_BINARY=bin/misspell
|
||||||
MISSPELL = $(TOOLS_DIR)/$(MISSPELL_BINARY)
|
MISSPELL = $(TOOLS_DIR)/$(MISSPELL_BINARY)
|
||||||
|
|
||||||
|
|
@ -66,14 +67,27 @@ misspell: $(MISSPELL)
|
||||||
misspell-correction: $(MISSPELL)
|
misspell-correction: $(MISSPELL)
|
||||||
$(MISSPELL) -w $(ALL_DOCS)
|
$(MISSPELL) -w $(ALL_DOCS)
|
||||||
|
|
||||||
|
.PHONY: normalized-link-check
|
||||||
|
# NOTE: we check `model/[a-z]*` to avoid `model/README.md`, which contains
|
||||||
|
# valid occurrences of `../docs/`.
|
||||||
|
normalized-link-check:
|
||||||
|
@if grep -R '\.\./docs/' docs model/[a-z]*; then \
|
||||||
|
echo "\nERROR: Found occurrences of '../docs/'; see above."; \
|
||||||
|
echo " Remove the '../docs/' from doc page links referencing doc pages."; \
|
||||||
|
exit 1; \
|
||||||
|
else \
|
||||||
|
echo "Normalized-link check passed."; \
|
||||||
|
fi
|
||||||
|
|
||||||
.PHONY: markdown-link-check
|
.PHONY: markdown-link-check
|
||||||
markdown-link-check:
|
markdown-link-check: normalized-link-check
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
--mount 'type=bind,source=$(PWD),target=/home/repo' \
|
--mount 'type=bind,source=$(PWD),target=/home/repo' \
|
||||||
lycheeverse/lychee \
|
lycheeverse/lychee \
|
||||||
--config home/repo/.lychee.toml \
|
--config home/repo/.lychee.toml \
|
||||||
--root-dir /home/repo \
|
--root-dir /home/repo \
|
||||||
--verbose \
|
--verbose \
|
||||||
|
$(MARKDOWN_LINK_CHECK_ARG) \
|
||||||
home/repo
|
home/repo
|
||||||
|
|
||||||
.PHONY: markdown-link-check-changelog-preview
|
.PHONY: markdown-link-check-changelog-preview
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue