scripts/mdlinkcheck: markdown link checker

This script parses all markdown files in the repository, extracts all
links and verifies that they work.

It makes sure to only check the URLs once, even if used in multiple
links. There is a whitelist for URLs we deem unnecessary to check.

It uses curl to do the checks.

As a bonus, this makes it easy to run this check locally.

Closes #15742
This commit is contained in:
Daniel Stenberg 2024-12-14 13:29:10 +01:00
parent 6bb76d92e1
commit 62515e8e9d
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 168 additions and 11 deletions

View file

@ -85,22 +85,14 @@ jobs:
# - name: check special prose
# run: proselint docs/internals/CHECKSRC.md docs/libcurl/curl_mprintf.md docs/libcurl/opts/CURLOPT_INTERFACE.md docs/cmdline-opts/interface.md
# Docs: https://github.com/UmbrellaDocs/action-linkspector
linkcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
name: checkout
- name: trim the cmdline docs markdown files
run: find docs/cmdline-opts -name "*.md" ! -name "_*" ! -name MANPAGE.md -print0 | xargs -0 -n1 .github/scripts/cleancmd.pl
- name: Run linkspector
uses: umbrelladocs/action-linkspector@fc382e19892aca958e189954912fe379a8df270c # v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
fail_on_error: true
- name: Run mdlinkcheck
run: ./scripts/mdlinkcheck
spellcheck:
runs-on: ubuntu-latest