mirror of
https://github.com/gaurav-nelson/github-action-markdown-link-check.git
synced 2024-07-14 23:30:26 +03:00
Check all links in markdown files if they are alive or dead. 🔗✔️
actionhacktoberfestlink-checkerlink-checkingmarkdownmarkdown-link-checkscheduled-runsstarred-gaurav-nelson-repostarred-repo
.github/workflows | ||
md | ||
.deepsource.toml | ||
action.yml | ||
Dockerfile | ||
entrypoint.sh | ||
LICENSE | ||
mlc_config.json | ||
README.md |
GitHub Action - Markdown link check 🔗✔️
This GitHub action checks all Markdown files in your repository for broken links. (Uses tcort/markdown-link-check)
How to use
-
Create a new file in your repository
.github/workflows/action.yml
. -
Copy-paste the following workflow in your
action.yml
file:name: Check Markdown links on: push jobs: markdown-link-check: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - uses: gaurav-nelson/github-action-markdown-link-check@0.6.0
Configuration
Custom variables
You cancustomize the action by using the following variables:
use-quiet-mode
: Specifyyes
to only show errors in output.use-verbose-mode
: Specifyyes
to show detailed HTTP status for checked links.config-file
: Specify a custom configuration file for markdown-link-check. You can use it to remove false-positives by specifying replacement patterns and ignore patterns.folder-path
: By default thegithub-action-markdown-link-check
action checks for all markdown files in your repository. Use this option to limit checks to only specific folders.
Sample workflow with variables
name: Check Markdown links
on: push
jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: gaurav-nelson/github-action-markdown-link-check@0.6.0
with:
use-quiet-mode: 'yes'
use-verbose-mode: 'yes'
config-file: 'mlc_config.json'
folder-path: 'docs/markdown_files'
Scheduled runs
In addition to checking links on every push, or pull requests, its also a good hygine to check for broken links regularly as well. See Workflow syntax for GitHub Actions - on.schedule for more details.
Sample workflow with scheduled job
name: Check Markdown links
on:
on:
push:
branches:
- master
schedule:
# Run everyday at 9:00 AM (See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07)
- cron: "0 9 * * *"
jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: gaurav-nelson/github-action-markdown-link-check@0.6.0
with:
use-quiet-mode: 'yes'
use-verbose-mode: 'yes'
config-file: 'mlc_config.json'
folder-path: 'docs/markdown_files'
Disable check for some links
You can include the following HTML comments into your markdown files to disable checking for certain links in a markdown document.
<!-- markdown-link-check-disable -->
and<!-- markdown-link-check-enable-->
: Use these to disable links for all links appearing between these comments.- Example:
<!-- markdown-link-check-disable --> ## Section Disbale link checking in this section. Ignore this [Bad Link](https://exampleexample.cox) <!-- markdown-link-check-enable -->
- Example:
<!-- markdown-link-check-disable-next-line -->
Use this comment to disable link checking for the next line.<!-- markdown-link-check-disable-line -->
Use this comment to disable link checking for the current line.