A GitHub action for link checking repository Markdown and HTML files.
When used in conjunction with Create Issue From File, issues will be created when Link Checker finds connectivity problems with links.
Using with the default settings will check all markdown and HTML files in your repository.
- name: Link Checker
uses: peter-evans/link-checker@v1
Link Checker uses Liche.
Liche arguments can be passed to the action via the args
parameter. If not set, the default -v -r *
will be used.
- name: Link Checker
uses: peter-evans/link-checker@v1
with:
args: -v -r *
See Liche's documentation for further argument details.
If Link Checker finds connectivity problems with links the action will output a markdown file containing the error report.
The default path is link-checker/out.md
. The path and filename may be overridden with the following variables.
LINKCHECKER_OUTPUT_DIR
- The output directory the markdown error reportLINKCHECKER_OUTPUT_FILENAME
- The error report filenameBelow is an example of using this action in conjunction with Create Issue From File. The workflow executes on a schedule every month. Issues will be created when Link Checker finds connectivity problems with links.
on:
schedule:
- cron: '0 0 1 * *'
name: Check markdown links
jobs:
linkChecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Link Checker
uses: peter-evans/link-checker@v1
- name: Create Issue From File
uses: peter-evans/create-issue-from-file@v2
with:
title: Link Checker Report
content-filepath: ./link-checker/out.md
labels: report, automated issue
This link is intentionally non-existent. The workflow in this repository generated this sample issue.
To create a failing check when there are link errors you can use the exit_code
output from the action as follows.
on: push
jobs:
linkChecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Link Checker
id: lc
uses: peter-evans/link-checker@v1
- name: Fail if there were link errors
run: exit ${{ steps.lc.outputs.exit_code }}