From c5fc7bae61b0bccaf49354e98a6141ee335f6a06 Mon Sep 17 00:00:00 2001 From: Sourabh Mehta Date: Wed, 12 Jun 2024 14:32:16 +0200 Subject: [PATCH] Markdown linting and link check --- .github/markdown-link-check.jsonc | 10 +++++++ .github/markdownlint.json | 18 ++++++++++++ .github/markdownlint.jsonc | 11 ++++++++ .github/workflows/markdown.yml | 47 +++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 .github/markdown-link-check.jsonc create mode 100644 .github/markdownlint.json create mode 100644 .github/markdownlint.jsonc create mode 100644 .github/workflows/markdown.yml diff --git a/.github/markdown-link-check.jsonc b/.github/markdown-link-check.jsonc new file mode 100644 index 0000000..56a381e --- /dev/null +++ b/.github/markdown-link-check.jsonc @@ -0,0 +1,10 @@ +{ + "httpHeaders": [ + { + "urls": ["https://github.com/", "https://guides.github.com/", "https://help.github.com/", "https://docs.github.com/"], + "headers": { + "Accept-Encoding": "zstd, br, gzip, deflate" + } + } + ], +} diff --git a/.github/markdownlint.json b/.github/markdownlint.json new file mode 100644 index 0000000..aebda81 --- /dev/null +++ b/.github/markdownlint.json @@ -0,0 +1,18 @@ +{ + "problemMatcher": [ + { + "owner": "markdownlint", + "severity": "warning", + "pattern": [ + { + "regexp": "^(.*):(\\d+)(:(\\d+))? (MD\\d+\\/[^ ]+) (.*)$", + "file": 1, + "line": 2, + "column": 4, + "code": 5, + "message": 6 + } + ] + } + ] +} diff --git a/.github/markdownlint.jsonc b/.github/markdownlint.jsonc new file mode 100644 index 0000000..20417d2 --- /dev/null +++ b/.github/markdownlint.jsonc @@ -0,0 +1,11 @@ +{ + "default": true, + "MD013": { + "line_length": 120 + }, + "MD014": false, + "MD029": false, + "MD025": false, + "MD034": false, + "MD041": false +} \ No newline at end of file diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml new file mode 100644 index 0000000..4930142 --- /dev/null +++ b/.github/workflows/markdown.yml @@ -0,0 +1,47 @@ +name: markdown +on: + pull_request: + paths: + - '.github/workflows/markdown.yml' + - '.github/markdownlint.json' + - '.github/markdownlint.jsonc' + - '.github/markdown-link-check.jsonc' + - '**/*.md' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +# Declare default permissions as read only. +permissions: read-all + +jobs: + markdown-lint: + name: Lint markdown files + runs-on: ubuntu-22.04 + steps: + - name: Checkout devtools + uses: actions/checkout@v4 + + - name: Register markdownlint warning matcher + run: | + echo "::add-matcher::.github/markdownlint.json" + + - name: Lint markdown files + uses: avto-dev/markdown-lint@v1 + with: + args: '**/*.md' + config: '.github/markdownlint.jsonc' + + - name: Remove markdownlint warning matcher + if: always() + run: | + echo "::remove-matcher owner=markdownlint::" + + - uses: gaurav-nelson/github-action-markdown-link-check@master + if: always() + with: + use-verbose-mode: 'yes' + check-modified-files-only: 'yes' + base-branch: ${{ github.base_ref }} + config-file: '.github/markdown-link-check.jsonc'