Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/docs_link_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Docs Broken Link Checker

on:
pull_request:
paths:
- "site/content/docs/main/**/*.md"
# Run weekly
schedule:
- cron: "0 7 * * 1"

# Allow manual runs
workflow_dispatch:

jobs:
link-check:
runs-on: ubuntu-latest

steps:
# Step 1: Checkout repository
- name: Checkout repository
uses: actions/checkout@v4

# Step 2: Run Lychee link checker on MAIN docs only
- name: Run Lychee link checker (main docs only)
uses: lycheeverse/lychee-action@v1
with:
args: >
--verbose
--no-progress
--timeout 20
--max-retries 3
--retry-wait-time 5
--exclude-mail
--accept 200,206,429
--ignore-path .lycheeignore
--output lychee-report.md
--format markdown
"site/content/docs/main/**/*.md"

# Step 3: Check if an open broken-link issue already exists
# This prevents weekly issue spam.
- name: Check if issue already exists
if: failure() && github.event_name == 'schedule'
id: issue-check
uses: actions/github-script@v7
with:
script: |
const query =
'repo:${{ github.repository }} ' +
'is:issue is:open ' +
'"Broken links detected in Contour documentation"';

const result = await github.rest.search.issuesAndPullRequests({
q: query
});

core.setOutput("exists", result.data.total_count > 0);

# Step 4: Create issue ONLY if none exists already
- name: Create GitHub issue (scheduled run only)
if: failure() && github.event_name == 'schedule' && steps.issue-check.outputs.exists == 'false'
uses: peter-evans/create-issue-from-file@v5
with:
title: "Broken links detected in Contour documentation"
content-filepath: lychee-report.md
labels: documentation, automated
28 changes: 28 additions & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Lychee Ignore File for Contour Documentation Link Checks

# Purpose:
# - Avoid false positives from placeholder/dev links
# - Ignore dynamic GitHub URLs that cannot be validated reliably
# - Reduce CI noise while still catching real broken links

# Local development links (not valid in CI)
localhost
127.0.0.1

# Placeholder/example domains used in docs
example.com
example.org

# Mail links are not checkable as HTTP URLs
mailto:*

# GitHub issue creation links are dynamic and often return redirects
https://github.com/projectcontour/contour/issues/new*
https://github.com/projectcontour/contour/issues?q=*

# GitHub compare URLs are temporary/dynamic
https://github.com/projectcontour/contour/compare/*

# Common documentation short-links that may rate-limit bots
https://twitter.com/*
https://x.com/*
Loading