-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
50 lines (42 loc) · 1.13 KB
/
check-toc.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
name: Check ToC
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
on:
push:
paths:
- ".github/workflows/check-toc.yml"
- "README.md"
- "FAQ.md"
pull_request:
paths:
- ".github/workflows/check-toc.yml"
- "README.md"
- "FAQ.md"
workflow_dispatch:
repository_dispatch:
jobs:
check:
name: ${{ matrix.file.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
file:
- name: README.md
# Max ToC depth, for use with the markdown-toc --maxdepth flag.
maxdepth: 4
- name: FAQ.md
maxdepth: 3
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install markdown-toc
run: sudo npm install --global markdown-toc
- name: Rebuild ToC
run: |
markdown-toc \
--bullets=- \
--maxdepth=${{ matrix.file.maxdepth }} \
-i \
"${{ github.workspace }}/${{ matrix.file.name }}"
- name: Check ToC
run: git diff --color --exit-code