Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/actions/markdown-link-checker/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Markdown Link Checker
description: Checks all Markdown files for broken links
inputs:
github-token:
description: GitHub token (not used, but kept for interface compatibility)
required: false
args:
description: Arguments to pass to markdown-link-check
required: false
default: "--quiet --retry"

runs:
using: "composite"
steps:
- name: Install markdown-link-check
shell: bash
run: npm install -g markdown-link-check

- name: Run link check on all Markdown files
shell: bash
run: |
set -euo pipefail
echo "🔍 Scanning all Markdown files for broken links..."
failed=0
total_dead_links=0

while IFS= read -r -d '' file; do
echo "------------------------------------------------------------"
echo "📄 Checking: $file"
output=$(markdown-link-check ${{ inputs.args }} "$file" 2>&1)
echo "$output"

if echo "$output" | grep -q '✖'; then
num_file_dead_links=$(echo "$output" | grep '✖' | wc -l)
echo "❌ $num_file_dead_links broken links in $file"
total_dead_links=$((total_dead_links + num_file_dead_links))
failed=1
else
echo "✅ No broken links in $file"
fi
done < <(find . -type f -name "*.md" -print0)

echo "------------------------------------------------------------"
if [ "$failed" -ne 0 ]; then
echo "❌ Total broken links found: $total_dead_links"
exit 1
else
echo "✅ All Markdown files passed link checks."
fi
6 changes: 6 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ jobs:
with:
go-version: ^1

- name: Run markdown link checker
uses: ./.github/actions/markdown-link-checker
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
args: "--quiet --retry"

- name: Restore pre-commit cache
id: cache-restore
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
Expand Down
Loading