Skip to content

Commit bb3a701

Browse files
committed
Added lychee config files
1 parent 4696495 commit bb3a701

File tree

4 files changed

+151
-0
lines changed

4 files changed

+151
-0
lines changed

.github/lychee.toml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# .github/lychee.toml
2+
3+
############################# Display #############################
4+
# Verbose program output
5+
# Accepts log level: "error", "warn", "info", "debug", "trace"
6+
verbose = "info"
7+
8+
# Don't show interactive progress bar while checking links.
9+
no_progress = false
10+
11+
############################# Cache ###############################
12+
# Enable link caching. This can be helpful to avoid checking the same links on
13+
# multiple runs.
14+
cache = true
15+
16+
# Discard all cached requests older than this duration.
17+
max_cache_age = "1d"
18+
19+
############################# Runtime #############################
20+
# Maximum number of concurrent link checks.
21+
max_concurrency = 12
22+
23+
# Maximum number of allowed redirects.
24+
max_redirects = 10
25+
26+
# Maximum number of allowed retries before a link is declared dead.
27+
max_retries = 5
28+
29+
############################# Requests ############################
30+
# Website timeout from connect to response finished.
31+
timeout = 60
32+
33+
# Minimum wait time in seconds between retries of failed requests.
34+
retry_wait_time = 3
35+
36+
# Accept more status codes (follow redirects automatically)
37+
accept = ["200..=204", "301..=308", "429"]
38+
39+
# Avoid false fragment errors
40+
include_fragments = false
41+
42+
# Only test links with the given schemes (e.g. https).
43+
# Omit to check links with any other scheme.
44+
# At the moment, we support http, https, file, and mailto.
45+
scheme = ["https"]
46+
47+
# When links are available using HTTPS, treat HTTP links as errors.
48+
require_https = false
49+
50+
# Fallback extensions to apply when a URL does not specify one.
51+
# This is common in documentation tools that cross-reference files without extensions.
52+
fallback_extensions = ["md", "html"]
53+
54+
############################# Exclusions ##########################
55+
# Check links inside `<code>` and `<pre>` blocks as well as Markdown code
56+
# blocks.
57+
include_verbatim = false
58+
59+
# Ignore case of paths when matching glob patterns.
60+
glob_ignore_case = false
61+
62+
# Exclude URLs and mail addresses from checking (supports regex).
63+
exclude = [
64+
'^mailto:',
65+
'^https?://localhost',
66+
'^https?://127\\.0\\.0\\.1',
67+
'^https://www\.linkedin\.com',
68+
'^https?://web\\.archive\\.org/web/'
69+
]
70+
71+
# Exclude these filesystem paths from getting checked.
72+
exclude_path = [
73+
'(^|/)node_modules/',
74+
'(^|/)dist/',
75+
'(^|/)bin/',
76+
'\\.txt$', # skip .txt extensions
77+
'(^|/)test/' # skip directories named "test"
78+
]
79+
80+
# URLs to check (supports regex). Has preference over all excludes.
81+
include = ['gist\.github\.com.*']
82+
83+
# Skip checking mail addresses
84+
include_mail = true
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Check Links In Pull Requests
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
check-links:
7+
runs-on: ubuntu-latest
8+
steps:
9+
# Step 1: Checkout the repo
10+
- name: Checkout GitHub repo
11+
uses: actions/checkout@v4
12+
13+
# Step 2: Run Lychee to check links
14+
- name: Run Lychee link checker
15+
uses: lycheeverse/lychee-action@v2
16+
with:
17+
args: |
18+
--no-progress
19+
--include-fragments
20+
21+
# Step 3: Provide a helpful message if the check fails
22+
- name: Helpful failure message
23+
if: ${{ failure() }}
24+
run: |
25+
echo "::error::Link check failed! Please review the broken links reported above."
26+
echo ""
27+
echo "If certain links are valid but fail due to:"
28+
echo "- CAPTCHA challenges"
29+
echo "- IP blocking"
30+
echo "- Authentication requirements"
31+
echo "- Rate limiting"
32+
echo ""
33+
echo "Consider adding them to .lycheeignore to bypass future checks."
34+
echo "Format: Add one URL pattern per line"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
*.orig
55
.vscode
66
.idea
7+
.lycheecache

.lycheeignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# These links are ignored by lychee link checker: https://github.com/lycheeverse/lychee
2+
# The file allows you to list multiple regular expressions for exclusion (one pattern per line).
3+
# The `.lycheeignore` file is only used for excluding URLs, not paths. Use the `exclude_path` key in the `lychee.toml` file. ref: https://lychee.cli.rs/recipes/excluding-paths/
4+
5+
# GitHub blob/tree fragment links
6+
^https://github\.com/umbraco/Umbraco-CMS/blob/.*/.*#L.*
7+
^https://github\.com/umbraco/Umbraco-CMS/tree/.*
8+
^https://github\.com/Shazwazza/Articulate/blob/.*/.*#L.*
9+
^https://github\.com/umbraco/Umbraco-CMS/blob/.*
10+
11+
# Anchor/fragment links causing false positives
12+
^https://docs\.umbraco\.com/.*/#.*
13+
^https://apidocs\.umbraco\.com/.*/#.*
14+
^https://tinymce\.github\.io/.*/#.*
15+
^https://openid\.net/.*/#.*
16+
^https://docs\.microsoft\.com/.*#.*
17+
^https://learn\.microsoft\.com/.*#.*
18+
^https://developer\.mozilla\.org/.*/#.*
19+
^https://learning\.postman\.com/docs/.*/#.*
20+
^https://nginx\.org/.*/#.*
21+
^https://azure\.microsoft\.com/en-gb/services/media-services/.*
22+
^https://www\.tiny\.cloud/docs/.*
23+
24+
# TinyMCE anchors
25+
^https://github\.com/tinymce/tinymce/issues/.*#.*
26+
27+
# NIST FIPS and other static docs
28+
^https://csrc\.nist\.gov/publications/PubsFIPS\.html#.*
29+
30+
# Timeout-prone Umbraco issue links
31+
^https://issues\.umbraco\.org/issue/.*
32+
^https://issues\.umbraco\.org/issues/.*

0 commit comments

Comments
 (0)