Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

peter-evans/link-checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Link Checker

GitHub Marketplace

⚠️ 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.

  • LINKCHECKER_OUTPUT_DIR - The output directory the markdown error report
  • LINKCHECKER_OUTPUT_FILENAME - The error report filename

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