Skip to content

Commit 539b117

Browse files
committed
Add lychee-based link checker
1 parent f39efe4 commit 539b117

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

.github/workflows/check-links.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# https://github.com/lycheeverse/lychee-action
2+
# https://github.com/lycheeverse/lychee
3+
name: Check Links
4+
5+
on:
6+
push:
7+
schedule:
8+
# Run monthly
9+
# GitHub actions uses UTC for time zone
10+
# crontab format: minute hour day-of-month month day-of-week
11+
- cron: "18 4 4 * *"
12+
workflow_dispatch:
13+
inputs:
14+
message:
15+
description: Message to display in job summary
16+
required: false
17+
type: string
18+
workflow_call:
19+
inputs:
20+
message:
21+
description: Message to display in job summary
22+
required: false
23+
type: string
24+
verbose:
25+
description: verbosity level
26+
required: false
27+
type: string
28+
default: -v
29+
progress-bar:
30+
description: display progress bar
31+
required: false
32+
type: string
33+
default: --no-progress
34+
valid-codes:
35+
description: valid http return status codes
36+
required: false
37+
type: string
38+
default: -a '200,403,429,500'
39+
base-directory:
40+
description: root directory to check relative URLs
41+
required: false
42+
type: string
43+
default: .
44+
fail-mode:
45+
description: true=fail action on failed check
46+
type: boolean
47+
default: true
48+
additional-args:
49+
description: Additional command-line arguments (see https://github.com/lycheeverse/lychee#commandline-parameters)
50+
required: false
51+
type: string
52+
input-files:
53+
description: Files to check links in
54+
required: false
55+
type: string
56+
default: ./**/*.md
57+
58+
jobs:
59+
link-checker:
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@v4
63+
- name: Link Checker
64+
id: lychee
65+
uses: lycheeverse/lychee-action@v1
66+
with:
67+
# args: --base . --verbose --no-progress -a '200,403,429,500' './**/*.md'
68+
# args: --config ./.github/workflows/lychee.toml './**/*.md'
69+
args: ${{ inputs.verbose }} ${{ inputs.progress-bar }} ${{ inputs.valid-codes }} ${{ inputs.base-directory }} ${{ inputs.fail-mode }} ${{inputs.additional-args }} ${{ inputs.input-files }}
70+
fail: ${{ inputs.message }}
71+
- name: Print the job summary
72+
if: ${{ inputs.message }}
73+
run: |
74+
echo ${{ inputs.message }} >$GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)