Skip to content

Commit 719c9db

Browse files
authored
Merge pull request #387 from maxmind/greg/stf-557
Validate and update links (STF-557)
2 parents 1124773 + b06732b commit 719c9db

8 files changed

Lines changed: 134 additions & 5 deletions

File tree

.github/workflows/links.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Links
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: "0 13 * * 1" # weekly, to catch external link rot without a commit
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
linkChecker:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
18+
with:
19+
persist-credentials: false
20+
21+
- name: Setup mise
22+
uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
23+
with:
24+
install: false
25+
26+
# Install only lychee (not the repo's full toolchain) and run the check.
27+
- name: Check links
28+
env:
29+
MISE_AUTO_INSTALL: "false"
30+
run: |
31+
mise install lychee
32+
mise run check-links

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ target
2323
/sample/run.sh
2424
reports
2525
Test.java
26+
.lycheecache

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ Please report all issues with this code using the [GitHub issue
285285
tracker](https://github.com/maxmind/MaxMind-DB-Reader-java/issues).
286286

287287
If you are having an issue with a MaxMind database or service that is not
288-
specific to this reader, please [contact MaxMind support](https://www.maxmind.com/en/support).
288+
specific to this reader, please [contact MaxMind support](https://support.maxmind.com/knowledge-base).
289289

290290
## Requirements ##
291291

UPGRADING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,4 +252,4 @@ To help identify code that needs updating, you can search your codebase for:
252252
If you encounter issues during the upgrade, please check:
253253

254254
- [GitHub Issues](https://github.com/maxmind/MaxMind-DB-Reader-java/issues)
255-
- [MaxMind Support](https://www.maxmind.com/en/support)
255+
- [MaxMind Support](https://support.maxmind.com/knowledge-base)

lychee.toml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Lychee link checker configuration
2+
# https://lychee.cli.rs/#/usage/config
3+
#
4+
# Run locally with:
5+
# lychee './**/*.md' './src/**/*.java' './pom.xml'
6+
7+
# Include URL fragments in checks
8+
include_fragments = true
9+
10+
# Don't allow any redirects, so links that have moved are surfaced and updated
11+
# to their canonical destination.
12+
max_redirects = 0
13+
14+
# Accept these HTTP status codes
15+
# 100-103: Informational responses
16+
# 200-299: Success responses
17+
# 403: Forbidden (some sites use this for rate limiting)
18+
# 429: Too Many Requests
19+
# 500-599: Server errors (temporary issues shouldn't fail CI)
20+
# 999: LinkedIn's custom status code
21+
accept = ["100..=103", "200..=299", "403", "429", "500..=599", "999"]
22+
23+
# Exclude URL patterns from checking (treated as regular expressions)
24+
exclude = [
25+
'^file://',
26+
# Live / auth-gated endpoints that appear as string literals or require login
27+
'^https://geoip\.maxmind\.com',
28+
'^https://geolite\.info',
29+
'^https://minfraud\.maxmind\.com',
30+
'^https://sandbox\.maxmind\.com',
31+
'^https://updates\.maxmind\.com',
32+
'^https://www\.maxmind\.com/en/accounts/',
33+
'https://www\.maxmind\.com/en/account/login',
34+
# XML namespace identifiers in pom.xml (not real links)
35+
'^http://www\.w3\.org/',
36+
'^http://maven\.apache\.org/',
37+
'^https://maven\.apache\.org/xsd/',
38+
'^http://java\.sun\.com/',
39+
'^http://schemas\.',
40+
# Maven property placeholder in a build-time download URL (not a real link)
41+
'japicmp\.baselineVersion',
42+
# Placeholders / local
43+
'^https?://example\.(com|org|net)',
44+
'^http://localhost',
45+
'127\.0\.0\.1',
46+
]
47+
48+
# Exclude file paths from getting checked (treated as regular expressions)
49+
exclude_path = [
50+
'(^|/)node_modules/',
51+
'(^|/)target/',
52+
# Test fixtures (MaxMind-DB submodule) contain example URLs, not ours
53+
'(^|/)src/test/resources/',
54+
# Changelog: historical entries are preserved as-is, not rewritten
55+
'(^|/)CHANGELOG\.md$',
56+
]
57+
58+
# Cache results for 1 day to speed up repeated checks
59+
cache = true
60+
max_cache_age = "1d"
61+
62+
# Skip missing input files instead of erroring
63+
skip_missing = true

mise.lock

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mise.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ disable_backends = [
99
[tools]
1010
hugo = "latest"
1111
java = "latest"
12+
lychee = "latest"
1213
maven = "latest"
1314

1415
[tasks.build-docs]
@@ -19,6 +20,10 @@ run = "hugo --source docs --minify"
1920
description = "Serve the docs site locally with Hugo dev server"
2021
run = "hugo server --source docs"
2122

23+
[tasks.check-links]
24+
description = "Check links with lychee"
25+
run = "lychee --no-progress './**/*.md' './src/**/*.java' './pom.xml'"
26+
2227
[hooks]
2328
enter = "mise install --quiet --locked"
2429

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
<packaging>jar</packaging>
88
<name>MaxMind DB Reader</name>
99
<description>Reader for MaxMind DB</description>
10-
<url>http://dev.maxmind.com/</url>
10+
<url>https://dev.maxmind.com/</url>
1111
<licenses>
1212
<license>
1313
<name>Apache License 2.0</name>
14-
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
14+
<url>https://www.apache.org/licenses/LICENSE-2.0.html</url>
1515
<distribution>repo</distribution>
1616
</license>
1717
</licenses>
1818
<organization>
1919
<name>MaxMind, Inc.</name>
20-
<url>http://www.maxmind.com/</url>
20+
<url>https://www.maxmind.com/en/home</url>
2121
</organization>
2222
<scm>
2323
<url>https://github.com/maxmind/MaxMind-DB-Reader-java</url>

0 commit comments

Comments
 (0)