Reusable GitHub Action (Bash-only checker) for Markdown links.
It reports and optionally fails on:
404redirect_to_404(initial response is3xx, final resolved response is404)402and403- any
5xx
The action generates a Markdown table report with:
- file path
- line number
- original URL
- final URL after redirects
- HTTP status
- issue type
name: Markdown Link Check
on:
schedule:
# Every Monday at 08:00 UTC
- cron: '0 8 * * 1'
pull_request:
paths:
- '**/*.md'
- '**/*.markdown'
push:
paths:
- '**/*.md'
- '**/*.markdown'
workflow_dispatch:
jobs:
links:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run markdown link checker action
id: link_check
uses: academic/link-checker@v1
with:
report-file: link-check-results.md
fail-on-issue: "true"
- name: Upload report artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: markdown-link-check-report
path: ${{ steps.link_check.outputs.report-file }}report-file: output report path. Default:link-check-results.mdfail-on-issue: whether to fail the job when issues are found. Default:"true"user-agent: User-Agent for HTTP requests. Default:markdown-link-check-github-action
checked-count: number of links checkedissue-count: number of matching issues foundreport-file: generated report path
- This repository should be tagged (for example
v1) before external usage. - Example tagging commands:
git tag -a v1 -m "Release v1"
git push origin v1