Skip to content

Commit 0a8e38f

Browse files
tghosthclaude
andauthored
Replace deprecated URL checker action with direct invocation (OWASP#3332)
* Replace deprecated URL checker action with maintained fork gaurav-nelson/github-action-markdown-link-check is explicitly deprecated and points to tcort/github-action-markdown-link-check as its successor. The new action is actively maintained by the upstream markdown-link-check package author and uses the same config file format. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Test: add intentionally broken link to verify URL checker This broken link should trigger a failure in the URL checker workflow, confirming the new action correctly detects dead links. This commit should be reverted before merging. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Debug: add verbose output and direct markdown-link-check test - Add a step that runs markdown-link-check directly (outside Docker) to see raw output and verify it detects the broken link - Disable quiet mode and enable verbose mode on the action step - This is a temporary debug commit to be reverted Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Replace Docker-based action with direct markdown-link-check invocation The tcort/github-action-markdown-link-check Docker action has a known bug (OWASP#553) where markdown-link-check silently fails inside the container, reporting all links as good without checking anything. This replaces the action with direct npm installation and invocation of markdown-link-check, which works correctly on the runner. Also fixes the PR modified-files detection by using fetch-depth: 0 for proper git diff. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Remove intentionally broken test link The URL checker has been verified to correctly detect broken links. Removing the test link added for debugging. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f3ad55d commit 0a8e38f

1 file changed

Lines changed: 29 additions & 13 deletions

File tree

.github/workflows/url-checker.yml

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,39 @@ jobs:
1717
steps:
1818
- name: Checkout
1919
uses: actions/checkout@v4.2.2
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Install markdown-link-check
24+
run: npm i -g markdown-link-check@3.14.2
2025

21-
- name: Set options
22-
id: options
26+
- name: Determine files to check
27+
id: files
2328
run: |
2429
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
25-
echo "check-modified-files-only=yes" >> $GITHUB_OUTPUT
26-
echo "use-verbose-mode=yes" >> $GITHUB_OUTPUT
30+
git diff --name-only --diff-filter=AM origin/${{ github.base_ref }} -- 5.0/ | grep '\.md$' > /tmp/files_to_check.txt || true
31+
echo "mode=modified" >> $GITHUB_OUTPUT
2732
else
28-
echo "check-modified-files-only=no" >> $GITHUB_OUTPUT
29-
echo "use-verbose-mode=no" >> $GITHUB_OUTPUT
33+
find 5.0 -name '*.md' -not -path './node_modules/*' > /tmp/files_to_check.txt
34+
echo "mode=all" >> $GITHUB_OUTPUT
3035
fi
36+
echo "Checking files (mode: $(cat $GITHUB_OUTPUT | grep mode | cut -d= -f2)):"
37+
cat /tmp/files_to_check.txt
3138
3239
- name: Check URLs
33-
uses: gaurav-nelson/github-action-markdown-link-check@v1
34-
with:
35-
check-modified-files-only: ${{ steps.options.outputs.check-modified-files-only }}
36-
config-file: .github/workflows/config/url-checker-config.json
37-
folder-path: '5.0'
38-
use-quiet-mode: yes
39-
use-verbose-mode: ${{ steps.options.outputs.use-verbose-mode }}
40+
run: |
41+
ERROR_FOUND=0
42+
while IFS= read -r file; do
43+
if [ -n "$file" ]; then
44+
markdown-link-check "$file" --config .github/workflows/config/url-checker-config.json -q || ERROR_FOUND=1
45+
fi
46+
done < /tmp/files_to_check.txt
47+
48+
if [ "$ERROR_FOUND" -eq 1 ]; then
49+
echo ""
50+
echo "ERROR: Dead links were found!"
51+
exit 1
52+
else
53+
echo ""
54+
echo "All links are good!"
55+
fi

0 commit comments

Comments
 (0)