Giter VIP home page Giter VIP logo

lychee-action's Introduction

lychee link checking action

GitHub Marketplace

Quickly check links in Markdown, HTML, and text files using lychee.

When used in conjunction with Create Issue From File, issues will be created when the action finds link problems.

Usage

Here is a full example of a Github workflow file. It will check all repository links once per day and create an issue in case of errors. Save this under .github/workflows/links.yml:

name: Links

on:
  repository_dispatch:
  workflow_dispatch:
  schedule:
    - cron: "00 18 * * *"

jobs:
  linkChecker:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Link Checker
        uses: lycheeverse/[email protected]
        with:
          args: --verbose --no-progress **/*.md **/*.html
        env:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
        
      - name: Create Issue From File
        uses: peter-evans/create-issue-from-file@v2
        with:
          title: Link Checker Report
          content-filepath: ./lychee/out.md
          labels: report, automated issue

Detailed arguments (args) information

This action uses lychee for link checking. lychee arguments can be passed to the action via the args parameter.

- name: Link Checker
  uses: lycheeverse/[email protected]
  with:
    args: --verbose --no-progress *.md

See lychee's documentation for all possible arguments.

Optional environment variables

Issues with links will be written to a file containing the error report. The default path is lychee/out.md. The path and filename may be overridden with the following variable:

  • LYCHEE_OUT - The path to the output file for the Markdown error report

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: lychee Link Checker
        id: lychee
        uses: lycheeverse/[email protected]
      - name: Fail if there were link errors
        run: exit ${{ steps.lychee.outputs.exit_code }}

Troubleshooting and common problems

See lychee's Troubleshooting Guide for solutions to common link-checking problems.

Performance

A full CI run to scan 576 links takes approximately 1 minute for the analysis-tools-dev/static-analysis repository.

Credits

This action is based on peter-evans/link-checker and uses lychee (written in Rust) instead of liche (written in Go) for link checking. For a comparison of both tools, check out this comparison table.

License

lychee is licensed under either of

at your option.

lychee-action's People

Contributors

krlmlr avatar ltalirz avatar mre avatar pawroman avatar robertlugg avatar wael-sadek avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.