From df9a3a4a92d3bc858910ffbc484834e462b38e0f Mon Sep 17 00:00:00 2001 From: Daniel Holbach Date: Wed, 8 Apr 2020 17:31:03 +0200 Subject: [PATCH] add GH Action to check links simplify checking of links fix some links fail properly Don't check docs directory twice attempt fixing erroring out update bits update theme don't check GH home update theme --- .github/workflows/check-links.yaml | 56 +++++++++++++++++++ .../workflows/markdown-link-check-config.json | 6 ++ docs/requirements.txt | 6 +- mkdocs.yml | 2 +- 4 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/check-links.yaml create mode 100644 .github/workflows/markdown-link-check-config.json diff --git a/.github/workflows/check-links.yaml b/.github/workflows/check-links.yaml new file mode 100644 index 000000000..acdc2d2d1 --- /dev/null +++ b/.github/workflows/check-links.yaml @@ -0,0 +1,56 @@ +name: docs + +on: + pull_request: + push: + branches: + - master + +jobs: + markdown-link-checker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install markdown-link-check + run: | + npm i markdown-link-check + + - name: Check non-user-guide markdown docs + run: | + find . \ + -name vendor -prune -o \ + -name node_modules -prune -o \ + -name docs -prune -o \ + -iname '*.md' \ + -exec ./node_modules/markdown-link-check/markdown-link-check -q --config .github/workflows/markdown-link-check-config.json {} + + + site-link-checker: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.8] + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r docs/requirements.txt + + - name: Build docs for link check + run: mkdocs build + + # Using liche action to check generated HTML site + - name: Link Checker (generated site) + id: lc2 + uses: peter-evans/link-checker@v1 + with: + args: -d site/ -r site/ -x 'github.com/weaveworks/ignite($|/issue|/pull)' -c 10 + + - name: Fail if there were link errors + run: exit ${{ steps.lc2.outputs.exit_code }} diff --git a/.github/workflows/markdown-link-check-config.json b/.github/workflows/markdown-link-check-config.json new file mode 100644 index 000000000..813ca2044 --- /dev/null +++ b/.github/workflows/markdown-link-check-config.json @@ -0,0 +1,6 @@ +{ + "ignorePatterns": [ + { "pattern": "^https://github.com/\\S+/\\S+/(issues|pull)/" }, + { "pattern": "^mailto:" } + ] +} diff --git a/docs/requirements.txt b/docs/requirements.txt index 3ea9b3597..4cb5af659 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,3 @@ -mkdocs == 1.1 -mkdocs-material == 5.0.1 -pymdown-extensions >= 7.0.0 +mkdocs == 1.1.2 +mkdocs-material == 5.2.2 +pymdown-extensions >= 7.1 diff --git a/mkdocs.yml b/mkdocs.yml index 1994d2c00..a3d4b6e79 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -28,6 +28,6 @@ markdown_extensions: - admonition - codehilite: guess_lang: false - - pymdownx.superfences + - pymdownx.tabbed - toc: permalink: true