Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
*: add docs formatter and checker
Browse files Browse the repository at this point in the history
Signed-off-by: Paweł Krupa (paulfantom) <pawel@krupa.net.pl>
  • Loading branch information
paulfantom committed May 11, 2022
1 parent ce20e46 commit 892cf88
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/go.yml
Expand Up @@ -85,3 +85,19 @@ jobs:
go generate ./...
git diff --exit-code
docs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Set up Go ${{ env.golang-version }}
uses: actions/setup-go@v3.0.0
with:
go-version: ${{ env.golang-version }}

- name: download mdox
run: go install -a github.com/bwplotka/mdox@latest

- run: make check-docs

6 changes: 6 additions & 0 deletions .mdox.validate.yaml
@@ -0,0 +1,6 @@
version: 1

validators:
# Ignore localhost links.
- regex: 'localhost'
type: "ignore"
14 changes: 14 additions & 0 deletions Makefile
Expand Up @@ -2,6 +2,8 @@ GIT_COMMIT ?= $(shell git rev-list -1 HEAD)
GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
LOCAL_DOCKER_BASE := local/dev_promscale_extension
GHCR_DOCKER_BASE := ghcr.io/timescale/dev_promscale_extension
MDOX_BIN=mdox
MDOX_VALIDATE_CONFIG=

.PHONY: build
build: generate
Expand Down Expand Up @@ -50,5 +52,17 @@ generate-helm: deploy/helm-chart/templates/prometheus-rule.yaml
deploy/helm-chart/templates/prometheus-rule.yaml:
./scripts/generate-helm-alerts.sh

MDOX_VALIDATE_CONFIG?=.mdox.validate.yaml
MD_FILES_TO_FORMAT=$(shell find -type f -name '*.md')
.PHONY: docs
docs:
@echo ">> formatting and local/remote links"
$(MDOX_BIN) fmt --soft-wraps -l --links.validate.config-file=$(MDOX_VALIDATE_CONFIG) $(MD_FILES_TO_FORMAT)

.PHONY: check-docs
check-docs:
@echo ">> checking formatting and local/remote links"
$(MDOX_BIN) fmt --soft-wraps --check -l --links.validate.config-file=$(MDOX_VALIDATE_CONFIG) $(MD_FILES_TO_FORMAT)

.PHONY: all
all: build test go-fmt go-lint

0 comments on commit 892cf88

Please sign in to comment.