Skip to content

Commit 229472d

Browse files
committed
Add CI workflow to check for missed updates to readme ToC
On every push or pull request that affects the repository's README.md, check whether the table of contents matches the content.
1 parent 59052b1 commit 229472d

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

.github/workflows/check-toc.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Check ToC
2+
3+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
4+
on:
5+
push:
6+
paths:
7+
- ".github/workflows/check-toc.ya?ml"
8+
- "README.md"
9+
pull_request:
10+
paths:
11+
- ".github/workflows/check-toc.ya?ml"
12+
- "README.md"
13+
workflow_dispatch:
14+
repository_dispatch:
15+
16+
jobs:
17+
check:
18+
name: ${{ matrix.file.name }}
19+
runs-on: ubuntu-latest
20+
21+
strategy:
22+
fail-fast: false
23+
24+
matrix:
25+
file:
26+
- name: README.md
27+
# Max ToC depth, for use with the markdown-toc --maxdepth flag.
28+
maxdepth: 3
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v2
33+
34+
- name: Install markdown-toc
35+
run: sudo npm install --global markdown-toc
36+
37+
- name: Rebuild ToC
38+
run: |
39+
markdown-toc \
40+
--bullets=- \
41+
--maxdepth=${{ matrix.file.maxdepth }} \
42+
-i \
43+
"${{ github.workspace }}/${{ matrix.file.name }}"
44+
45+
- name: Check ToC
46+
run: git diff --color --exit-code

0 commit comments

Comments
 (0)