Skip to content

Commit

Permalink
feat(ci): validate link workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
swarna1101 committed Dec 18, 2024
1 parent 3f6f7c8 commit efc967e
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/config/lychee.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Ignore certain URLs or patterns
exclude = [
"localhost", # Ignore localhost links
"example.com", # Ignore example domains
"http://127.0.0.1" # Ignore local IP links
]

# Retry failed links before reporting
retry = 3

# Timeout for links (in seconds)
timeout = 10

# Acceptable status codes
accept = [200, 403]

# Maximum concurrency for checking links
max_concurrency = 10
36 changes: 36 additions & 0 deletions .github/workflows/check-broken-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Check Broken Links

on:
pull_request:
paths:
- "**/*.md"
- "**/*.mdx"
- "**/*.html"

jobs:
link-check:
name: Validate Links
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install Lychee
run: |
wget -q https://github.com/lycheeverse/lychee/releases/latest/download/lychee-linux-x86_64.tar.gz
tar -xzf lychee-linux-x86_64.tar.gz
sudo mv lychee /usr/local/bin/
- name: Run Link Checker
run: |
lychee \
--config .github/config/lychee.toml \
--accept=200,403 \
--no-progress \
'**/*.md' '**/*.mdx' '**/*.html'
- name: Report Failure on Broken Links
if: failure()
run: |
echo "::error:: Broken links detected. Please fix them before merging."

0 comments on commit efc967e

Please sign in to comment.