Links are checked only when a markdown file is changed #2
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
# Checks if all links are valid, i.e. not broken | |
# | |
# Errors are reported via an Issue being created, | |
# instead of via en email to all repository Watchers | |
name: Check links | |
# Only run this on the main branch, or with Pull Requests | |
on: | |
push: | |
paths: | |
- 'docs/**' | |
- .github/workflows/check_links.yaml | |
pull_request: | |
paths: | |
- 'docs/**' | |
- .github/workflows/check_links.yaml | |
jobs: | |
check_links: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Remove folders that need not to be checked | |
run: | | |
rm -rf docs/not_used/ | |
rm -rf docs/python/not_used/ | |
rm -rf docs/julia/not_used/ | |
rm -rf docs/R/not_used/ | |
rm -rf docs/matlab/not_used/ | |
- name: Restore lychee cache | |
uses: actions/cache@v4 | |
with: | |
path: .lycheecache | |
key: cache-lychee-${{ github.sha }} | |
restore-keys: cache-lychee- | |
- name: Link Checker | |
id: lychee | |
uses: lycheeverse/[email protected] | |
with: | |
# Check all reStructuredText files in repo | |
args: --base docs/ --max-redirects 10 --user-agent "curl/8.4.0" --verbose --no-progress './**/*.rst' | |
- name: Create Issue From File | |
if: env.lychee_exit_code != 0 | |
uses: peter-evans/create-issue-from-file@v5 | |
with: | |
title: Link Checker Report | |
content-filepath: ./lychee/out.md | |
labels: report, automated issue |