-
Notifications
You must be signed in to change notification settings - Fork 133
link checker - fails PR if links are broken #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8af34cc
link checker - fails PR if links are broken
clubanderson 7f338b1
remove custom action from workflow
elevran a528fff
make README links relative
elevran 3a2aa2a
replace markdown-link-check tool with lychee
elevran c546818
remove markdown-link-check tool action
elevran fba8ce6
move lychee configuration to toplevel - same as other tools
elevran 9979e4e
use regexp, not shell glob in config
elevran d0293e5
check all link - not just those the refer to md files
elevran 2f3a08e
increase timeouts and ignore gnu's website since it throttles by time…
elevran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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:
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
400error code isBad Requestwhich suggests that the tool is faulty or misconfigured for our environment.