Skip to content

Use flint for link checking#16270

Merged
trask merged 1 commit intoopen-telemetry:mainfrom
zeitlinger:use-flint-for-link-checks
Feb 24, 2026
Merged

Use flint for link checking#16270
trask merged 1 commit intoopen-telemetry:mainfrom
zeitlinger:use-flint-for-link-checks

Conversation

@zeitlinger
Copy link
Member

@zeitlinger zeitlinger commented Feb 23, 2026

Summary

Replace the three contrib-hosted link check scripts with flint's consolidated lint:links task.

Benefits:

  • SHA-pinned script deps — the contrib URLs used refs/heads/main (mutable); flint pins to a commit SHA so builds are reproducible
  • Better PR link checking — flint automatically remaps GitHub /blob/main/ and /tree/main/ URLs to the PR branch, preventing false failures when files are added or moved in a PR
  • Consolidated script — 3 scripts → 1 script that auto-detects PR vs push mode
  • Renovate custom manager — an inlined regex custom manager keeps the SHA-pinned script URL up to date automatically
  • Autofix support — consistent AUTOFIX=true mise run lint across all lint tasks

Changes:

  • mise.toml: replace 3 contrib-hosted task URLs with 1 flint URL (SHA-pinned to v0.7.0)
  • .github/workflows/reusable-link-check.yml: simplify PR/push steps (flint handles mode detection)
  • .github/renovate.json5: add inline custom manager to keep the SHA-pinned flint URL up to date

Context: I originally created the link check scripts in opentelemetry-java-contrib. Flint is a generalization of that work into a reusable toolbox — it's been adopted by several Grafana repos already.

Test plan

  • CI link check passes on this PR (exercises the PR code path)
  • Verify mise run lint:links --full works locally (exercises the push code path)

@zeitlinger zeitlinger requested a review from a team as a code owner February 23, 2026 09:08
@zeitlinger
Copy link
Member Author

@trask This is a small PR to try out flint for link checking here. Flint is basically a generalization of the link check scripts I originally created in opentelemetry-java-contrib — packaged as reusable mise tasks with some improvements.

Key differences from the current setup:

  1. SHA-pinned scripts — the current contrib URLs use refs/heads/main (mutable), flint pins to a commit SHA for reproducible builds
  2. GitHub URL remapping — for PRs, flint remaps /blob/main/ URLs to the PR branch so new/moved files don't cause false failures
  3. Single consolidated script — replaces 3 separate scripts with 1 that auto-detects PR vs push mode
  4. Renovate presetgithub>grafana/flint keeps both the script URL and tool versions updated automatically

I kept this intentionally minimal — just link checking. Happy to discuss if you have any concerns about the approach or the dependency on grafana/flint.

@zeitlinger zeitlinger marked this pull request as draft February 23, 2026 09:54
zeitlinger added a commit to grafana/flint that referenced this pull request Feb 23, 2026
## Summary

- Strip line-number anchors (`#L123`, `#L10-L20`) from ALL GitHub
`/blob/` URLs (any repo), so the file is still checked but the
JS-rendered fragment is skipped
- Exclude issue comment anchors (`#issuecomment-*`) globally — these are
JS-rendered and cannot be verified by lychee
- Remove the global `lychee#1729` remap workaround from flint's own
`lychee.toml` (now handled by the script)
- Add test cases for both patterns

This means consuming repos no longer need to add these exclusions to
their `lychee.toml` configs. Discovered while adopting flint in
[opentelemetry-java-instrumentation#16270](open-telemetry/opentelemetry-java-instrumentation#16270).

## Test plan
- [ ] CI link check passes (exercises the new test links in
`tests/test-links.md`)
- [ ] External repo line-number anchor test (`okhttp
build.gradle#L144-L153`) passes
- [ ] Issue comment anchor test passes

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger zeitlinger marked this pull request as ready for review February 23, 2026 12:15
@zeitlinger zeitlinger force-pushed the use-flint-for-link-checks branch from bf215dc to d576f9d Compare February 24, 2026 06:45
@zeitlinger zeitlinger force-pushed the use-flint-for-link-checks branch 2 times, most recently from 69a898a to 9b88d0e Compare February 24, 2026 07:25
@zeitlinger zeitlinger force-pushed the use-flint-for-link-checks branch from 9b88d0e to 10b2c9d Compare February 24, 2026 07:36
@zeitlinger zeitlinger force-pushed the use-flint-for-link-checks branch 2 times, most recently from c1c3005 to 496365f Compare February 24, 2026 09:50
@zeitlinger zeitlinger marked this pull request as draft February 24, 2026 09:55
@zeitlinger zeitlinger force-pushed the use-flint-for-link-checks branch from 496365f to 9b88d0e Compare February 24, 2026 09:57
Replace the three contrib-hosted link check scripts with flint's
consolidated lint:links task.

- mise.toml: replace 3 contrib-hosted task URLs with 1 flint URL
  (SHA-pinned to v0.7.0)
- reusable-link-check.yml: simplify PR/push steps (flint handles
  mode detection)
- renovate.json5: add inline custom manager to keep the SHA-pinned
  flint URL up to date
- lychee.toml: remove workarounds for lychee#1729 (flint handles
  this), add line-number anchor exclude
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger zeitlinger force-pushed the use-flint-for-link-checks branch from 9b88d0e to ff7ef39 Compare February 24, 2026 09:58
@zeitlinger zeitlinger marked this pull request as ready for review February 24, 2026 10:01
@trask trask merged commit 592fa15 into open-telemetry:main Feb 24, 2026
85 checks passed
@zeitlinger zeitlinger deleted the use-flint-for-link-checks branch February 25, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants