-
Notifications
You must be signed in to change notification settings - Fork 61
50 lines (42 loc) · 1.28 KB
/
markdown_linter.yml
File metadata and controls
50 lines (42 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Markdown Linter
on:
# Scan changed files in PRs (diff-aware scanning):
pull_request: {}
# Scan mainline branches and report all findings:
push:
branches: ["main"]
jobs:
markdown-lint-check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install markdownlint-cli
run: npm install -g markdownlint-cli
- name: Get changed markdown files
id: files
uses: tj-actions/changed-files@v46
with:
files: |
README.md
1.0/en/**/*.md
- name: Run markdownlint on changed files
if: steps.files.outputs.any_changed == 'true'
run: |
files_string="${{ steps.files.outputs.all_changed_files }}"
files_string="${files_string//\\n/$'\n'}"
files=()
while IFS= read -r file; do
[ -n "$file" ] && files+=("$file")
done <<< "$files_string"
if [ ${#files[@]} -eq 0 ]; then
echo "No files to check."
exit 0
fi
markdownlint --config .github/workflows/config/markdownlint.jsonc "${files[@]}"