Skip to content

Add CI workflow to check for missed updates to readme ToC #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 15, 2021
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/check-toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Check ToC

# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
paths:
- ".github/workflows/check-toc.ya?ml"
- "README.md"
pull_request:
paths:
- ".github/workflows/check-toc.ya?ml"
- "README.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: 3

steps:
- name: Checkout repository
uses: actions/checkout@v2

- 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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ projects:
- [`path`](#path)
- [`version`](#version)
- [`compliance`](#compliance)
- [`format`](#format)
- [`library-manager`](#library-manager)
- [`project-type`](#project-type)
- [`recursive`](#recursive)
- [`report-file`](#report-file)
- [`verbose`](#verbose)
- [`token`](#token)
- [Usage](#usage)
- [Contributing](#contributing)

<!-- tocstop -->

Expand Down