Skip to content

Commit 3c5fe83

Browse files
committed
Skip check for 502, 522 errors
1 parent a88b5fe commit 3c5fe83

File tree

2 files changed

+49
-9
lines changed

2 files changed

+49
-9
lines changed

.github/lychee.toml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,17 @@ timeout = 10
3131
retry_wait_time = 1
3232

3333
# Accept more status codes (follow redirects automatically)
34-
accept = ["200..=204", "301..=308", "429", "502", "522"]
34+
# Note: 522 and 502 are server errors, not broken links
35+
accept = [
36+
"200..=204",
37+
"301..=308",
38+
"429",
39+
"502", # Bad Gateway
40+
"522" # Connection timed out (Cloudflare)
41+
]
3542

36-
# Avoid false fragment errors
37-
include_fragments = false
43+
# Don't check fragments/anchors - they cause false positives
44+
include_fragments = false
3845

3946
# Only test links with the given schemes (e.g. https and http)
4047
scheme = ["https", "http"]
@@ -53,14 +60,20 @@ exclude = [
5360
'^https?://localhost',
5461
'^https?://127\\.0\\.0\\.1',
5562
'^https://www\\.linkedin\\.com',
56-
# Exclude all issues.umbraco.org links (they're unreliable)
57-
'issues\\.umbraco\\.org',
63+
64+
# Exclude all issues.umbraco.org - unreliable and often returns 522
65+
'http://issues\\.umbraco\\.org',
66+
'https://issues\\.umbraco\\.org',
67+
5868
# Exclude umbraco.com blog posts that return errors
59-
'umbraco\\.com/blog/',
69+
'https://umbraco\\.com/blog/',
70+
6071
# Exclude web archive links
6172
'web\\.archive\\.org/web/',
62-
# Exclude anchor links to version-specific sections (e.g., #umbraco-14)
63-
'#umbraco-[0-9]+',
73+
74+
# Exclude internal links with version anchors
75+
'version-specific#umbraco-',
76+
'README\\.md#umbraco-[0-9]',
6477
]
6578

6679
# Exclude these filesystem paths from getting checked.

.github/workflows/check-broken-pr-links.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ jobs:
6464
}
6565

6666
/\[ERROR\]/ {
67+
# Skip anchor errors for #umbraco-[number] patterns
68+
if ($0 ~ /#umbraco-[0-9]+/) next
69+
6770
msg = $0
6871
sub(/^- \[ \] /, "", msg)
6972
sub(/^\[ERROR\] /, "", msg)
@@ -91,6 +94,30 @@ jobs:
9194
next
9295
}
9396

97+
/\[522\]/ {
98+
# Skip 522 errors from issues.umbraco.org
99+
if ($0 ~ /issues\.umbraco\.org/) next
100+
101+
msg = $0
102+
sub(/^- \[ \] /, "", msg)
103+
sub(/^\[522\] /, "", msg)
104+
gsub(/\|/, "\\|", msg)
105+
print "\n⚠ Server error (522) → " msg "\n" >> "lychee/comment.md"
106+
next
107+
}
108+
109+
/\[502\]/ {
110+
# Skip 502 errors from umbraco.com
111+
if ($0 ~ /umbraco\.com/) next
112+
113+
msg = $0
114+
sub(/^- \[ \] /, "", msg)
115+
sub(/^\[502\] /, "", msg)
116+
gsub(/\|/, "\\|", msg)
117+
print "\n⚠ Server error (502) → " msg "\n" >> "lychee/comment.md"
118+
next
119+
}
120+
94121
/Timeout/ && !/Timeouts/ {
95122
msg = $0
96123
sub(/^- \[ \] /, "", msg)
@@ -131,4 +158,4 @@ jobs:
131158
if: steps.format-report.outputs.has_content == 'true'
132159
run: |
133160
echo "❌ Broken links detected. Please review the PR comment for details."
134-
exit 1
161+
exit 1

0 commit comments

Comments
 (0)