Skip to content

Commit

Permalink
feat: markdown linter Makefile command and gh-action
Browse files Browse the repository at this point in the history
  • Loading branch information
lotyp committed Apr 24, 2024
1 parent 59202cc commit 6e60616
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
16 changes: 15 additions & 1 deletion .github/workflows/integrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
- name: 📦 Check out the codebase
uses: actions/checkout@v4.1.1

# See: https://github.com/wagoid/commitlint-github-action
- name: 🧐 Lint commits using "commitlint"
uses: wagoid/commitlint-github-action@v6.0.1
with:
Expand All @@ -47,4 +46,19 @@ jobs:
file_or_dir: '.'
strict: true

markdown-linting:
timeout-minutes: 4
runs-on: ubuntu-latest
concurrency:
cancel-in-progress: true
group: markdown-linting-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
steps:
- name: 📦 Check out the codebase
uses: actions/checkout@v4.1.1

- name: 🧐 Lint Markdown files
uses: DavidAnson/markdownlint-cli2-action@v16.0.0
with:
globs: '**/*.md' '#CHANGELOG.md'

...
6 changes: 6 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/DavidAnson/markdownlint/v0.34.0/schema/markdownlint-config-schema.json",
"line-length": false,
"no-inline-html": false,
"first-line-h1": false
}
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ ACTION_LINT_RUNNER ?= $(DOCKER) run --rm $$(tty -s && echo "-it" || echo) \
rhysd/actionlint:latest \
-color

MARKDOWN_LINT_RUNNER ?= $(DOCKER) run --rm $$(tty -s && echo "-it" || echo) \
-v $(shell pwd):/app \
--workdir /app \
davidanson/markdownlint-cli2-rules:latest

#
# Self documenting Makefile code
# ------------------------------------------------------------------------------------
Expand Down Expand Up @@ -84,6 +89,14 @@ lint-actions: ## Lint all github actions
@$(ACTION_LINT_RUNNER)
.PHONY: lint-actions

lint-md: ## Lint all markdown files using markdownlint-cli2
@$(MARKDOWN_LINT_RUNNER) --fix "**/*.md" | tee -a $(MAKE_LOGFILE)
.PHONY: lint-md

lint-md-dry: ## Lint all markdown files using markdownlint-cli2 in dry-run mode
@$(MARKDOWN_LINT_RUNNER) "**/*.md" "#CHANGELOG.md" | tee -a $(MAKE_LOGFILE)
.PHONY: lint-md-dry

#
# Release
# ------------------------------------------------------------------------------------
Expand Down

0 comments on commit 6e60616

Please sign in to comment.