Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The run failed with 4 broken links:

...
🔍 Scanning all Markdown files for broken links...
------------------------------------------------------------
📄 Checking: ./README.md

  ERROR: 3 dead links found in ./README.md !
  [✖] /docs/architecture.md → Status: 400
  [✖] /docs/dp.md → Status: 400
  [✖] /DEVELOPMENT.md → Status: 400
❌ 3 broken links in ./README.md
------------------------------------------------------------
📄 Checking: ./DEVELOPMENT.md

  ERROR: 1 dead links found in ./DEVELOPMENT.md !
  [✖] https://www.gnu.org/software/make/ → Status: 0
❌ 1 broken links in ./DEVELOPMENT.md
------------------------------------------------------------
📄 Checking: ./docs/architecture.md

✅ No broken links in ./docs/architecture.md
------------------------------------------------------------
📄 Checking: ./docs/dp.md

✅ No broken links in ./docs/dp.md
------------------------------------------------------------
📄 Checking: ./docs/create_new_filter.md

✅ No broken links in ./docs/create_new_filter.md
------------------------------------------------------------
❌ Total broken links found: 4
Error: Process completed with exit code 1.

However, upon inspection (and actually clicking on the link...) - all are valid.
We can not merge this PR as it clearly produces false positives. The 400 error code is Bad Request which suggests that the tool is faulty or misconfigured for our environment.

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/ci-pr-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ jobs:
- name: go mod tidy
run: go mod tidy

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

- name: Run lint checks
uses: golangci/golangci-lint-action@v8
with:
Expand Down
Loading