-
Notifications
You must be signed in to change notification settings - Fork 6
55 lines (46 loc) · 1.58 KB
/
lint.yml
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
51
52
53
54
55
name: lint
on:
pull_request:
jobs:
lint-docs:
name: Lint Docs
runs-on: ubuntu-latest
steps:
- name: Get all changed markdown files
id: changed-markdown-files
uses: tj-actions/changed-files@v40
with:
files: |
./docs/**.md
- name: Check out code
if: steps.changed-markdown-files.outputs.any_changed == 'true'
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
# Assume PRs are less than 20 commits
fetch-depth: 20
- name: Setup node
if: steps.changed-markdown-files.outputs.any_changed == 'true'
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install node deps
if: steps.changed-markdown-files.outputs.any_changed == 'true'
run: |
pnpm i --frozen-lockfile
- name: Lint with markdownlint
if: steps.changed-markdown-files.outputs.any_changed == 'true'
run: |
npx markdownlint-cli2 ${{ steps.changed-markdown-files.outputs.all_changed_files }}
- name: Lint with zhlint
if: steps.changed-markdown-files.outputs.any_changed == 'true'
run: |
npm run config:zhlint
for file in ${{ steps.changed-markdown-files.outputs.all_changed_files }}; do
npx zhlint $file
done
- name: Lint with autocorrect
if: steps.changed-markdown-files.outputs.any_changed == 'true'
run: |
npm run lint:autocorrect ${{ steps.changed-markdown-files.outputs.all_changed_files }}