Home

Awesome

Link Checker

GitHub Marketplace

:warning: This action is deprecated. Please consider using lychee-action.

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.

Usage

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.

Optional environment variables

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.

Receiving issues containing the error report

Below 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

Issue sample

This link is intentionally non-existent. The workflow in this repository generated this sample issue.

Creating a failing check for link errors

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 }}

License

MIT