Skip to content

Commit

Permalink
improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
Astrosp committed Feb 22, 2024
1 parent 46cadc7 commit 0048f40
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Check Markdown links

on: push

jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: gaurav-nelson/[email protected]
10 changes: 10 additions & 0 deletions .linkcheck.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"default": true,
"MD004": { "style": "dash"},
"MD007": {"indent": 4},
"MD013": false,
"MD024": { "siblings_only": true},
"MD029": false,
"MD033": { "allowed_elements": [ "details" , "summary" ]},
"MD040": false
}
18 changes: 18 additions & 0 deletions markdown-link-check-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"ignorePatterns": [
{
"pattern": "^bundle.zip"
},
{
"pattern": "^/"
}
],
"httpHeaders": [
{
"urls": ["https://", "http://"],
"headers": {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0"
}
}
]
}
30 changes: 30 additions & 0 deletions scripts/apply_link_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
# Script in charge of auditing the released cheatsheets MD files
# in order to detect dead links
# cd ../
# find . -name \*.md -exec markdown-link-check -c ../.linkcheck.json {} \; 1>../link-check-result.out 2>&1
# errors=`grep -c "ERROR:" ../link-check-result.out`
# content=`cat ../link-check-result.out`
# if [[ $errors != "0" ]]
# then
# echo "[!] Error(s) found by the Links validator: $errors CS have dead links !"
# exit $errors
# else
# echo "[+] No error found by the Links validator."
# fi

# Only check the specific README.md file
target_file="../README.md"

# Run link check with specific file and redirect output
markdown-link-check -c ../.linkcheck.json "$target_file" 1>../link-check-result.out 2>&1

# Check for errors and handle appropriately
errors=$(grep -c "ERROR:" ../link-check-result.out)

if [[ $errors != "0" ]]; then
echo "[!] Error(s) found in 'README.md': $errors broken links!"
exit $errors
else
echo "[+] No errors found in 'README.md'."
fi

0 comments on commit 0048f40

Please sign in to comment.