From 229472d134da0bdb38333aed7d7759356c0b2d34 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 15 May 2021 03:10:14 -0700 Subject: [PATCH 1/2] 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. --- .github/workflows/check-toc.yml | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/check-toc.yml diff --git a/.github/workflows/check-toc.yml b/.github/workflows/check-toc.yml new file mode 100644 index 0000000..d724c71 --- /dev/null +++ b/.github/workflows/check-toc.yml @@ -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 From b1b1b8bcde381359b11c01e835a4bd36a24bba79 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 15 May 2021 03:13:31 -0700 Subject: [PATCH 2/2] Sync ToC with readme content --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 00826b5..b9c4581 100644 --- a/README.md +++ b/README.md @@ -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)