Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
91 changes: 91 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Lint

permissions:
contents: read

on:
pull_request:
branches: [master, vnext]
paths:
- 'docs/**/*.mdx'
- 'docs/**/*.md'
- '.markdownlint.json'
- 'cspell.json'

jobs:
markdown-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'

- run: npm ci

- name: Get changed markdown files
id: changed
run: |
FILES=$(git diff --name-only --diff-filter=ACMR origin/${{ github.base_ref }}...HEAD -- 'docs/**/*.mdx' 'docs/**/*.md' | tr '\n' ' ')
echo "files=$FILES" >> "$GITHUB_OUTPUT"
echo "Found changed files: $FILES"

- name: Markdownlint (changed files)
if: steps.changed.outputs.files != ''
run: npx markdownlint ${{ steps.changed.outputs.files }}

- name: Summary
if: always() && steps.changed.outputs.files != ''
run: |
echo "## Markdownlint Results" >> "$GITHUB_STEP_SUMMARY"
RESULT=$(npx markdownlint ${{ steps.changed.outputs.files }} 2>&1 || true)
ERRORS=$(echo "$RESULT" | grep -c "MD[0-9]" || echo "0")
FILES_WITH_ERRORS=$(echo "$RESULT" | grep "MD[0-9]" | cut -d: -f1 | sort -u | wc -l || echo "0")
echo "**$ERRORS errors** in **$FILES_WITH_ERRORS files**" >> "$GITHUB_STEP_SUMMARY"
if [ "$ERRORS" -gt 0 ]; then
echo '```' >> "$GITHUB_STEP_SUMMARY"
echo "$RESULT" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
fi

spellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'

- run: npm ci

- name: Get changed markdown files
id: changed
run: |
FILES=$(git diff --name-only --diff-filter=ACMR origin/${{ github.base_ref }}...HEAD -- 'docs/**/*.mdx' 'docs/**/*.md' | tr '\n' ' ')
echo "files=$FILES" >> "$GITHUB_OUTPUT"

- name: CSpell (changed files)
if: steps.changed.outputs.files != ''
run: npx cspell --no-progress ${{ steps.changed.outputs.files }}

- name: Summary
if: always() && steps.changed.outputs.files != ''
run: |
echo "## CSpell Results" >> "$GITHUB_STEP_SUMMARY"
RESULT=$(npx cspell --no-progress ${{ steps.changed.outputs.files }} 2>&1 || true)
ERRORS=$(echo "$RESULT" | grep -c "Unknown word" || echo "0")
FILES_WITH_ERRORS=$(echo "$RESULT" | grep "Unknown word" | cut -d: -f1 | sort -u | wc -l || echo "0")
echo "**$ERRORS errors** in **$FILES_WITH_ERRORS files**" >> "$GITHUB_STEP_SUMMARY"
if [ "$ERRORS" -gt 0 ]; then
echo '```' >> "$GITHUB_STEP_SUMMARY"
echo "$RESULT" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
fi
50 changes: 50 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"default": true,
"MD001": false,
"MD003": false,
"MD004": { "style": "dash" },
"MD007": { "indent": 2 },
"MD009": { "br_spaces": 2 },
"MD010": true,
"MD012": { "maximum": 4 },
"MD013": false,
"MD014": true,
"MD018": true,
"MD019": true,
"MD022": false,
"MD023": true,
"MD024": false,
"MD025": false,
"MD026": { "punctuation": ".,;:" },
"MD027": true,
"MD028": false,
"MD029": { "style": "ordered" },
"MD030": true,
"MD031": true,
"MD032": false,
"MD033": false,
"MD034": false,
"MD035": { "style": "---" },
"MD036": false,
"MD037": true,
"MD038": true,
"MD039": true,
"MD040": false,
"MD041": false,
"MD042": true,
"MD043": false,
"MD044": false,
"MD045": false,
"MD046": false,
"MD047": false,
"MD048": { "style": "backtick" },
"MD049": false,
"MD050": { "style": "asterisk" },
"MD051": false,
"MD052": false,
"MD055": false,
"MD056": false,
"MD058": true,
"MD059": false,
"MD060": false
}
4 changes: 4 additions & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
dist/
.astro/
generated/
Loading
Loading