A GitHub Action that automatically checks for broken links in your files.
- π Smart URL Detection: Automatically extracts URLs from markdown links
[text](url)
and bare URLs - β‘ Concurrent Checking: Configurable number of concurrent workers for fast link validation
- β±οΈ Timeout Control: Configurable timeout for each link check
- π Fallback Strategy: Uses HEAD request first, falls back to GET if needed
- π Clear Reporting: Displays working and broken links with clear visual indicators
- β CI/CD Integration: Fails the workflow when broken links are found
name: Check Links
on: [push, pull_request]
jobs:
link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check links in README
uses: yankeexe/action-link-checker@v1
with:
file_path: 'README.md'
name: Check Links
on: [push, pull_request]
jobs:
link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check links with custom settings
uses: yankeexe/action-link-checker@v1
with:
file_path: 'docs/README.md'
concurrent_workers: '50'
timeout_seconds: '10'
name: Check Links
on: [push, pull_request]
jobs:
link-check:
runs-on: ubuntu-latest
strategy:
matrix:
file: ['README.md', 'docs/CONTRIBUTING.md', 'docs/API.md']
steps:
- uses: actions/checkout@v4
- name: Check links in ${{ matrix.file }}
uses: yankeexe/action-link-checker@v1
with:
file_path: ${{ matrix.file }}
Input | Description | Required | Default |
---|---|---|---|
file_path |
Path to the file to parse for links | β Yes | - |
concurrent_workers |
Number of concurrent workers for checking links | β No | 30 |
timeout_seconds |
Timeout in seconds for each link check | β No | 5 |
This action doesn't produce outputs but will:
- β Pass: When all links are working
- β Fail: When broken links are found (exits with code 1)
β
Working URLs:
- https://github.com/yankeexe/action-link-checker
- https://docs.github.com/en/actions
- https://golang.org/
β Invalid URLs:
- https://broken-link-example.com/404
- https://another-broken-link.invalid/
The action detects and validates:
[GitHub](https://github.com)
[Documentation](https://docs.example.com)
Visit https://example.com for more info
Check out https://github.com/user/repo
- name: Check links with higher concurrency
uses: yankeexe/action-link-checker@v1
with:
file_path: 'large-document.md'
concurrent_workers: '50'
timeout_seconds: '15'
- name: Check links with extended timeout
uses: yankeexe/action-link-checker@v1
with:
file_path: 'README.md'
timeout_seconds: '30'
Perfect for checking links in documentation files, README files, and markdown-based websites.
Validate external links in blog posts and articles before publishing.
Ensure all API endpoint links and external references are working.
- Ensure the
file_path
is correct and the file exists - Check that your workflow has checked out the repository (
actions/checkout
)
- Increase
timeout_seconds
for slow-responding servers - Some servers may block automated requests; this is expected behavior
- Reduce
concurrent_workers
if you encounter rate limiting - Some APIs may have strict rate limits for automated tools
- The action reads the specified file and extracts URLs using regex pattern matching
- It identifies both markdown-style links
[text](url)
and bare URLs - For each unique URL, it first attempts a HEAD request (faster, less bandwidth)
- If the HEAD request fails, it falls back to a GET request
- Results are collected and reported, with the action failing if any broken links are found
- The action currently only checks a single file at a time (use matrix strategy for multiple files)
- Some websites block automated requests, which may result in false negatives
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
β If this action helped you, please consider giving it a star!