Skip to content

Merge pull request #57 from thomas779/main #24

Merge pull request #57 from thomas779/main

Merge pull request #57 from thomas779/main #24

Workflow file for this run

on:
workflow_dispatch:
push:
branches:
- 'main'
pull_request:
jobs:
check-links:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Check out base branch
run: git checkout ${{github.event.pull_request.base.ref}}
- name: Dump all links from ${{github.event.pull_request.base.ref}}
uses: lycheeverse/lychee-action@v2
with:
args: |
--dump
--include-fragments
.
output: ./existing-links.txt
continue-on-error: true # Don't fail if base branch check has issues
- name: Stash untracked files
run: git stash push --include-untracked
- name: Check out feature branch
run: git checkout ${{ github.head_ref }}
- name: Apply stashed changes
run: git stash pop || true
- name: Update ignore file
run: |
if [ -f "existing-links.txt" ]; then
cat existing-links.txt >> .lycheeignore
fi
- name: Check links
uses: lycheeverse/lychee-action@v2
with:
args: |
--no-progress
--include-fragments
.
--base ./pages/
--fallback-extensions mdx
- name: Provide helpful failure message
if: failure()
run: |
echo "::error::Link check failed! Please review the broken links reported above."
echo ""
echo "If certain links are valid but fail due to:"
echo "- CAPTCHA challenges"
echo "- IP blocking"
echo "- Authentication requirements"
echo "- Rate limiting"
echo ""
echo "Consider adding them to .lycheeignore to bypass future checks."
echo "Format: Add one URL pattern per line"
exit 1