Skip to content

feat: Add Broken Link Checker workflow for Markdown files #1834

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 2 commits into from
Jun 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/broken-links-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Broken Link Checker

on:
pull_request:
paths:
- '**/*.md'
workflow_dispatch:

jobs:
markdown-link-check:
name: Check Markdown Broken Links
runs-on: ubuntu-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get Added/Modified Markdown Files (PR only)
id: changed-files
if: github.event_name == 'pull_request'
run: |
git fetch origin ${{ github.base_ref }}
files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '\.md$' || true)
echo "md_files<<EOF" >> $GITHUB_OUTPUT
echo "$files" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Check Broken Links in Added/Modified Files (PR)
if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != ''
uses: lycheeverse/lychee-action@v2.4.1
with:
args: >
--verbose --exclude-mail --no-progress --exclude ^https?://
${{ steps.changed-files.outputs.md_files }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check Broken Links in Entire Repo (Manual)
if: github.event_name == 'workflow_dispatch'
uses: lycheeverse/lychee-action@v2.4.1
with:
args: >
--verbose --exclude-mail --no-progress --exclude ^https?://
'**/*.md'
output: lychee/out.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}