Skip to content

Scheduled Broken Links Check #17

Scheduled Broken Links Check

Scheduled Broken Links Check #17

name: Scheduled Broken Links Check
on:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:
jobs:
check-links:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Restore lychee cache
uses: actions/cache@v4
with:
path: .lycheecache
key: cache-lychee-scheduled-${{ github.sha }}
restore-keys: |
cache-lychee-scheduled-
cache-lychee-
- name: Check external links
id: lychee-external
uses: lycheeverse/lychee-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: >-
--cache
--max-cache-age 72h
--verbose
--no-progress
--exclude-path ".git"
--exclude-path "node_modules"
--exclude-path "themes"
--exclude-path "static/lib"
--scheme "https"
--scheme "http"
--max-retries 6
--retry-wait-time 10
--timeout 45
--max-concurrency 4
--github-token "${{ github.token }}"
'./**/*.md'
'./**/*.html'
fail: false
format: markdown
output: ./lychee-external-report.md
- name: Check report content
id: check-report
run: |
if [ -f ./lychee-external-report.md ] && [ -s ./lychee-external-report.md ] && grep -q "Broken links found" ./lychee-external-report.md; then
echo "broken_links=true" >> $GITHUB_OUTPUT
else
echo "broken_links=false" >> $GITHUB_OUTPUT
fi
- name: Create issue
if: steps.lychee-external.outputs.exit_code != 0 && steps.check-report.outputs.broken_links == 'true'
uses: peter-evans/create-issue-from-file@v5
with:
title: 🔍 External Broken Links Report
content-filepath: ./lychee-external-report.md
labels: bug, documentation