2023-09-19 20:22:20 +00:00
|
|
|
name: Check links with Lychee
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
paths:
|
|
|
|
- "docs/**"
|
|
|
|
- "*.md"
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
# Remove default permissions of GITHUB_TOKEN for security
|
|
|
|
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
|
|
|
|
permissions: {}
|
|
|
|
|
|
|
|
jobs:
|
2023-09-21 07:50:20 +00:00
|
|
|
link-checker:
|
2023-09-19 20:22:20 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
# Cache lychee results (e.g. to avoid hitting rate limits)
|
|
|
|
- name: Restore lychee cache
|
2024-03-20 09:07:01 +00:00
|
|
|
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
2023-09-19 20:22:20 +00:00
|
|
|
with:
|
|
|
|
path: .lycheecache
|
|
|
|
key: cache-lychee-${{ github.sha }}
|
|
|
|
restore-keys: cache-lychee-
|
|
|
|
|
|
|
|
# check links with Lychee
|
2024-05-08 22:53:08 +00:00
|
|
|
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
|
2023-09-19 20:22:20 +00:00
|
|
|
|
|
|
|
- name: Lychee link checker
|
2024-04-29 12:30:39 +00:00
|
|
|
uses: lycheeverse/lychee-action@054a8e8c7a88ada133165c6633a49825a32174e2 # for v1.8.0
|
2023-09-19 20:22:20 +00:00
|
|
|
with:
|
|
|
|
# arguments with file types to check
|
|
|
|
args: >-
|
|
|
|
--cache
|
|
|
|
--verbose
|
|
|
|
--no-progress
|
|
|
|
--max-cache-age=1d
|
|
|
|
'./**/*.md'
|
|
|
|
'./**/*.html'
|
|
|
|
# fail the action on broken links
|
|
|
|
fail: true
|
|
|
|
env:
|
|
|
|
# to be used in case rate limits are surpassed
|
|
|
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|