Skip to content

Commit

Permalink
add markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb committed Feb 16, 2024
1 parent f80d754 commit a92435a
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/scripts/markdown-link-check-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"httpHeaders": [
{
"urls": ["https://crates.io"],
"headers": {
"Accept": "text/html"
}
}
]
}
17 changes: 17 additions & 0 deletions .github/scripts/markdown-link-check-with-retry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash -e

# this script helps to reduce sporadic link check failures by retrying at a file-by-file level

retry_count=3

for file in "$@"; do
for i in $(seq 1 $retry_count); do
if markdown-link-check --config "$(dirname "$0")/markdown-link-check-config.json" \
"$file"; then
break
elif [[ $i -eq $retry_count ]]; then
exit 1
fi
sleep 5
done
done
23 changes: 23 additions & 0 deletions .github/workflows/markdown-link-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Markdown link check

on:
pull_request:
push:
branches:
- main

jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install markdown-link-check
run: npm install -g markdown-link-check

- name: Run markdown-link-check
run: |
find . -type f \
-name '*.md' \
-not -path './CHANGELOG.md' \
| xargs .github/scripts/markdown-link-check-with-retry.sh

0 comments on commit a92435a

Please sign in to comment.