Add markdown link check.

Add linkcheck.sh that checks the links of all markdown files.
Add linkcheck task to Taskfile.yaml
Add link-check GitHub Action to add link checks on a daily schedule.
Add mlc config file to set access codes to pass.

Signed-off-by: nιcнolaѕ wιlde <ncwilde43@gmail.com>
This commit is contained in:
nιcнolaѕ wιlde 2022-06-01 03:36:34 +00:00
parent 1edaccc9cc
commit d3dbba3323
No known key found for this signature in database
GPG Key ID: F08AD0AD08B7D7A3
4 changed files with 39 additions and 0 deletions

24
.github/workflows/link-check.yaml vendored Normal file
View File

@ -0,0 +1,24 @@
---
name: link-check
on: # yamllint disable-line rule:truthy
# Schedule check each day at 8 UTC
schedule: [{cron: "0 8 * * *"}]
workflow_dispatch:
pull_request:
push:
branches:
- main
jobs:
markdown-link-check:
name: Markdown link check
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Check markdown links
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
file-path: './README.md'
config-file: './mlc_config.json'

View File

@ -20,6 +20,10 @@ tasks:
cmds: cmds:
- task: awesome-lint - task: awesome-lint
- task: yamllint - task: yamllint
linkcheck:
desc: Check for dead links
cmds:
- ./scripts/linkcheck.sh
render: render:
desc: Render README.md desc: Render README.md
cmds: cmds:

3
mlc_config.json Normal file
View File

@ -0,0 +1,3 @@
{
"aliveStatusCodes": [200, 206, 403, 429]
}

8
scripts/linkcheck.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
set -e
set -o pipefail
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" >/dev/null 2>&1 && pwd )
readonly DIR
for f in $(find "${DIR}" -name \*.md); do
docker run --rm -v /:/tmp:ro -i -w /tmp ghcr.io/tcort/markdown-link-check:stable "/tmp${f}" -c "/tmp${DIR}/mlc_config.json" || exit 1
done