Skip to content

Comments

feat: handle line-number anchors and issue comments globally#56

Merged
zeitlinger merged 1 commit intomainfrom
global-github-url-handling
Feb 23, 2026
Merged

feat: handle line-number anchors and issue comments globally#56
zeitlinger merged 1 commit intomainfrom
global-github-url-handling

Conversation

@zeitlinger
Copy link
Member

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.

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

Add global GitHub URL handling that applies to ALL repositories,
not just the current one:

- Line-number anchors (#L123, #L10-L20) on any GitHub /blob/ URL
  are stripped so the file is still checked but the JS-rendered
  fragment is skipped
- Issue comment anchors (#issuecomment-*) are excluded entirely
  as they are JS-rendered

This means consuming repos no longer need to add these exclusions
to their lychee.toml configs.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Copilot AI review requested due to automatic review settings February 23, 2026 09:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the link checking script to handle GitHub-specific URL patterns globally, eliminating the need for consuming repositories to configure these exclusions in their own lychee.toml files. The changes centralize handling of line-number anchors and issue comment anchors for any GitHub repository.

Changes:

  • Added global remap rule to strip line-number anchors (#L123, #L10-L20) from all GitHub /blob/ URLs
  • Added global exclusion for issue comment anchors (#issuecomment-*)
  • Removed the workaround remap from flint's own lychee.toml (now handled by script)

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tasks/lint/links.sh Added build_global_github_args() function to generate global remap and exclude rules for GitHub URLs
tests/test-links.md Added test cases for external repository line-number anchors and issue comment anchors
README.md Documented the new global GitHub URL handling behavior
.github/config/lychee.toml Removed the static remap rule (now handled dynamically by the script)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zeitlinger zeitlinger merged commit cf751df into main Feb 23, 2026
13 checks passed
@zeitlinger zeitlinger deleted the global-github-url-handling branch February 23, 2026 10:27
zeitlinger added a commit that referenced this pull request Feb 23, 2026
## Summary

Fixes the lint failure in #41 (release-please PR).

CLI `--exclude` overrides (rather than merges with) config file excludes
in lychee. The `--exclude` added in #56 for `#issuecomment-` URLs caused
the config file's `exclude` patterns (like the `compare/` URL exclusion)
to be ignored.

Fix: switch to `--remap` which strips the `#issuecomment-` fragment
while still checking the issue/PR page itself.

## Test plan
- [ ] CI passes (the release-please PR #41 should also pass after this
merges)

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
zeitlinger pushed a commit that referenced this pull request Feb 23, 2026
🤖 I have created a release *beep* *boop*
---


## [0.7.0](v0.6.0...v0.7.0)
(2026-02-23)


### Features

* handle line-number anchors and issue comments globally
([#56](#56))
([cf751df](cf751df))


### Bug Fixes

* **release-please:** fix footer not appearing on release PRs
([#40](#40))
([d7a55e4](d7a55e4))
* use remap instead of exclude for issue comment anchors
([#58](#58))
([656f355](656f355))

---
> [!IMPORTANT]
> Close and reopen this PR to trigger CI checks.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

1 participant