Skip to content

Fix link checker false positives on root-relative asset links - #927

Merged
spier merged 1 commit into
InnerSourceCommons:mainfrom
rrrutledge:fix-link-checker-root-dir
Aug 12, 2026
Merged

Fix link checker false positives on root-relative asset links#927
spier merged 1 commit into
InnerSourceCommons:mainfrom
rrrutledge:fix-link-checker-root-dir

Conversation

@rrrutledge

Copy link
Copy Markdown
Contributor

Problem

The link checker workflow only lints files changed in a PR, specifically to avoid failing PRs on pre-existing issues unrelated to their content — the workflow's own top comment says so.
But it still checks every link in a changed file, not just the diff, so any pre-existing root-relative link (e.g. /assets/img/foo.png) in a touched file trips it, since lychee isn't told the repo root and can't resolve a path starting with /.

This surfaced in #926, which failed the check on a pre-existing image link in patterns/1-initial/internal-developer-platform.md that the PR never touched — it only added a "Known Instances" bullet elsewhere in the file.

Fix

Pass --root-dir . to lychee so root-relative links resolve against the repo root instead of failing outright.

lychee cannot resolve links like /assets/img/foo.png without being told
the repo root, so any changed file containing a pre-existing root-relative
link fails the check even though the link is valid. Pass --root-dir . so
lychee resolves these against the repo root.

Observed in PR InnerSourceCommons#926, which failed on an unrelated pre-existing image link.
@spier spier added the ⚙️ Type - Meta Improving how we collaborate in this repo is the main focus of this issue / PR label Aug 12, 2026
@spier
spier merged commit 636e097 into InnerSourceCommons:main Aug 12, 2026
9 checks passed
@spier

spier commented Aug 12, 2026

Copy link
Copy Markdown
Member

@rrrutledge thank you for fixing this issue in the GHA.

I suspect we should apply the same fix to a similar GHA that runs once per week:
https://github.com/InnerSourceCommons/InnerSourcePatterns/blob/main/.github/workflows/link-checker.yml#L30?

I am doing that now.

@rrrutledge
rrrutledge deleted the fix-link-checker-root-dir branch August 12, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚙️ Type - Meta Improving how we collaborate in this repo is the main focus of this issue / PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants