Add lychee-based link checker #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/lycheeverse/lychee-action | |
# https://github.com/lycheeverse/lychee | |
name: Check Links | |
on: | |
push: | |
schedule: | |
# Run monthly | |
# GitHub actions uses UTC for time zone | |
# crontab format: minute hour day-of-month month day-of-week | |
- cron: "18 4 4 * *" | |
workflow_dispatch: | |
inputs: | |
message: | |
description: Message to display in job summary | |
required: false | |
type: string | |
workflow_call: | |
inputs: | |
message: | |
description: Message to display in job summary | |
required: false | |
type: string | |
verbose: | |
description: verbosity level | |
required: false | |
type: string | |
default: -v | |
progress-bar: | |
description: display progress bar | |
required: false | |
type: string | |
default: --no-progress | |
valid-codes: | |
description: valid http return status codes | |
required: false | |
type: string | |
default: -a '200,403,429,500' | |
base-directory: | |
description: root directory to check relative URLs | |
required: false | |
type: string | |
default: . | |
fail-mode: | |
description: true=fail action on failed check | |
type: boolean | |
default: true | |
additional-args: | |
description: Additional command-line arguments (see https://github.com/lycheeverse/lychee#commandline-parameters) | |
required: false | |
type: string | |
input-files: | |
description: Files to check links in | |
required: false | |
type: string | |
default: ./**/*.md | |
jobs: | |
link-checker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Link Checker | |
id: lychee | |
uses: lycheeverse/lychee-action@v1 | |
with: | |
# args: --base . --verbose --no-progress -a '200,403,429,500' './**/*.md' | |
# args: --config ./.github/workflows/lychee.toml './**/*.md' | |
args: ${{ inputs.verbose }} ${{ inputs.progress-bar }} ${{ inputs.valid-codes }} ${{ inputs.base-directory }} ${{ inputs.fail-mode }} ${{inputs.additional-args }} ${{ inputs.input-files }} | |
fail: ${{ inputs.message }} | |
- name: Print the job summary | |
if: ${{ inputs.message }} | |
run: | | |
echo ${{ inputs.message }} >$GITHUB_STEP_SUMMARY |