Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
32 changes: 32 additions & 0 deletions .github/workflows/links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Links

on:
push:
pull_request:
schedule:
- cron: "0 13 * * 1" # weekly, to catch external link rot without a commit
workflow_dispatch:

permissions:
contents: read

jobs:
linkChecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false

- name: Setup mise
uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1
with:
install: false

# Install only lychee (not the repo's full toolchain) and run the check.
- name: Check links
env:
MISE_AUTO_INSTALL: "false"
run: |
mise install lychee
mise run check-links
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,6 @@ sample/src/main/res/xml/network_security_config.xml
device-sdk-*.aar
device-sdk-*.jar
*.asc

# Lychee link checker cache
.lycheecache
3 changes: 1 addition & 2 deletions README.dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ and enter `trust` and choose ultimate.
Make sure the key shows up in `gpg --list-secret-keys`.

Make sure you publish it to a keyserver. See
[here](http://central.sonatype.org/pages/working-with-pgp-signatures.html) for
more info.
[here](https://central.sonatype.org/publish/requirements/gpg/) for more info.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using generic link text like 'here' is an accessibility anti-pattern because it does not provide descriptive context for screen readers or users scanning the document. Consider using more descriptive link text that clearly indicates the destination.

Suggested change
[here](https://central.sonatype.org/publish/requirements/gpg/) for more info.
[Sonatype's GPG requirements](https://central.sonatype.org/publish/requirements/gpg/) for more info.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pre-existing copy not changed by this PR (which only validates/updates link targets); leaving wording/accessibility edits out of scope here.

— Claude (posted on Greg's behalf)


### gpg "inappropriate ioctl" errors

Expand Down
64 changes: 64 additions & 0 deletions lychee.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Lychee link checker configuration
# https://lychee.cli.rs/#/usage/config
#
# Run locally with:
# lychee './**/*.md' './**/*.kt' './**/*.java'

# Include URL fragments in checks
include_fragments = true

# Don't allow any redirects, so links that have moved are surfaced and can be
# updated to their canonical destination.
max_redirects = 0

# Accept these HTTP status codes
# 100-103: Informational responses
# 200-299: Success responses
# 403: Forbidden (some sites use this for rate limiting)
# 429: Too Many Requests
# 500-599: Server errors (temporary issues shouldn't fail CI)
# 999: LinkedIn's custom status code
accept = ["100..=103", "200..=299", "403", "429", "500..=599", "999"]

# Exclude URL patterns from checking (treated as regular expressions)
exclude = [
# GitHub blob URLs with line-number fragments (not parseable as page anchors)
'^https://github\.com/[^/]+/[^/]+/blob/[0-9a-fA-F]+/.+#L\d+$',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current regular expression only matches GitHub blob URLs that contain a hexadecimal commit hash (due to [0-9a-fA-F]+). If a link references a branch name (such as main or master) with a line number fragment (e.g., .../blob/main/README.md#L10), it will not be excluded. Since lychee can fail to resolve line-number fragments on GitHub pages, this can lead to unexpected CI failures. Replacing [0-9a-fA-F]+ with [^/]+ will correctly match and exclude URLs with any branch name or commit hash.

Suggested change
'^https://github\.com/[^/]+/[^/]+/blob/[0-9a-fA-F]+/.+#L\d+$',
'^https://github\\.com/[^/]+/[^/]+/blob/[^/]+/.+#L\\d+$',

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This GitHub-blob exclude is taken verbatim from the dev-site lychee config and is intentionally narrow — it only skips unverifiable blob/<sha>#L.. line-fragment links. Branch-ref blob links are checked normally and resolve fine in these repos, so we kept the shared pattern.

— Claude (posted on Greg's behalf)

# Live / auth-gated MaxMind endpoints: appear as code string literals or
# require login, so they can't be verified by an anonymous request.
'^https://geoip\.maxmind\.com',
'^https://minfraud\.maxmind\.com',
'^https://sandbox\.maxmind\.com',
'^https://www\.maxmind\.com/en/accounts/',
'^https://www\.maxmind\.com/en/account/login',
# Device-tracking API endpoints: live collection endpoints hit by the SDK,
# not browsable pages.
'^https?://d-ipv[46]\.mmapiws\.com',
# Placeholder example/test server hosts used in docstrings and unit tests
# (not real, resolvable endpoints).
'^https://custom\.maxmind\.com',
'^https://test\.maxmind\.com',
# Local / placeholder URLs (e.g. example hosts in docs and tests)
'^file://',
'^https?://example\.(com|org|net)',
'^http://localhost',
'127\.0\.0\.1',
]

# Exclude file paths from getting checked (regular expressions, matched against
# the path relative to the working directory). Patterns are segment-anchored
# with (^|/) so short names like "build" don't match unintended paths.
exclude_path = [
'(^|/)build/',
'(^|/)\.gradle/',
'(^|/)node_modules/',
# Changelog: historical entries are preserved as-is, not rewritten
'(^|/)CHANGELOG\.md$',
]

# Cache results for 1 day to speed up repeated checks
cache = true
max_cache_age = "1d"

# Skip missing input files instead of erroring
skip_missing = true
29 changes: 29 additions & 0 deletions mise.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[settings]
lockfile = true

[tools]
# Java 21 is required - Dokka doesn't support Java 25+ yet
java = "temurin-21"
Expand All @@ -9,6 +12,7 @@ yamllint = "latest"
# prettier is used by precious for Markdown formatting
prettier = "latest"
android-sdk = "latest"
lychee = "latest"

[tasks.setup]
description = "Install Android SDK platform packages and configure local.properties"
Expand All @@ -34,3 +38,7 @@ fi

echo "Setup complete. Run './gradlew :device-sdk:test' to verify."
"""

[tasks.check-links]
description = "Check links with lychee"
run = "lychee --no-progress './**/*.md' './**/*.kt' './**/*.java'"
Loading