Skip to content

fix(lychee): exclude self-referential URLs and fix stale GitHub branch-protection docs link#309

Merged
ichoosetoaccept merged 2 commits intomainfrom
ismart/lychee-self-url-exclusions
Apr 16, 2026
Merged

fix(lychee): exclude self-referential URLs and fix stale GitHub branch-protection docs link#309
ichoosetoaccept merged 2 commits intomainfrom
ismart/lychee-self-url-exclusions

Conversation

@ichoosetoaccept
Copy link
Copy Markdown
Member

@ichoosetoaccept ichoosetoaccept commented Apr 16, 2026

Closes DOT-493
Closes DOT-494

Summary

  • Add three exclusion patterns to project/.lychee.toml.jinja for URLs that 404 on a fresh scaffold:
    • {repository_host}/{repository_namespace}/{repository_name}/... — covers workflow badges, action queries, the discussions URL, etc.
    • {repository_namespace}.github.io/{repository_name}/... — covers the GitHub Pages docs site that doesn't exist before first deploy.
    • pypi.org/project/{distribution_name} — only emitted when publish_to_pypi; won't exist before first release.
  • Replace the stale GitHub branch-protection docs link in project/README.md.jinja with the current about-protected-branches page.

Why

These URLs all 404 the first time lychee runs on a freshly scaffolded project (before the GitHub repo exists, before CI has run, before docs deploy, before publishing). They're user-owned anyway — lychee can't tell us anything we don't already know — so excluding them removes the noise without losing any real protection.

DOT-493 originally proposed enabling Discussions via the post-scaffold gh repo edit task. This PR takes the opposite approach: it stops lychee from gating the first commit on a feature the user may not want enabled. Either solution closes the user-visible bug.

Test plan

@linear
Copy link
Copy Markdown

linear Bot commented Apr 16, 2026

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 16, 2026

Greptile Summary

This PR adds three lychee regex exclusion patterns in .lychee.toml.jinja to suppress false-positive 404s on URLs that can't exist until after a repo is created, CI runs, docs deploy, and a package is published. It also replaces a stale GitHub branch-protection docs link in README.md.jinja with the current about-protected-branches page.

Confidence Score: 5/5

Safe to merge — all changes are targeted exclusion patterns and a doc link fix with no logic regressions.

No P0 or P1 findings. The exclusion regexes are correctly anchored with (/|$), the Pages-URL pattern is properly guarded by repository_host in ['github.com', 'gitlab.com'], and the PyPI pattern is guarded by publish_to_pypi. The README link replacement is a straightforward dead-link fix. Previously noted dot-escaping concern was already addressed in prior review threads.

No files require special attention.

Important Files Changed

Filename Overview
project/.lychee.toml.jinja Adds three conditional exclusion patterns for self-referential repo URLs, GitHub/GitLab Pages URLs, and PyPI project URLs; all patterns are correctly anchored and guarded by appropriate Jinja conditions.
project/README.md.jinja Replaces the stale GitHub branch-protection docs URL with the current about-protected-branches permalink; no logic changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[lychee runs on scaffolded project] --> B{URL matches exclusion pattern?}
    B -->|Self-referential repo URL\nhost/namespace/repo/*| C[Skip — repo doesn't exist yet]
    B -->|GitHub/GitLab Pages URL\nnamespace.host.io/repo/*| D[Skip — docs not deployed yet]
    B -->|PyPI project URL\npypi.org/project/distname| E[Skip — package not published yet\nonly if publish_to_pypi]
    B -->|No match| F[Check URL]
    F --> G{HTTP status}
    G -->|Accepted: 200,204,301,302,403,429,502| H[Pass]
    G -->|Other| I[Fail / report]
Loading

Reviews (3): Last reviewed commit: "fix(lychee): exclude self-referential UR..." | Re-trigger Greptile

Comment thread project/.lychee.toml.jinja
@ichoosetoaccept ichoosetoaccept force-pushed the ismart/dot-491-placeholder-test branch from 4785460 to 4c241cf Compare April 16, 2026 20:35
@ichoosetoaccept ichoosetoaccept force-pushed the ismart/lychee-self-url-exclusions branch from 6e70c0a to 829e28b Compare April 16, 2026 20:36
@ichoosetoaccept ichoosetoaccept force-pushed the ismart/dot-491-placeholder-test branch from 4c241cf to 77fb7b7 Compare April 16, 2026 21:24
Ismar Iljazovic added 2 commits April 16, 2026 23:25
…h-protection docs link

The lychee hook was 404'ing on a fresh scaffold for URLs that point at the
user's own repo (which doesn't exist on GitHub yet) and at the stale
`managing-a-branch-protection-rule` docs page (GitHub renamed the path).

Adds three exclusion patterns to `.lychee.toml.jinja`:
- `{repository_host}/{repository_namespace}/{repository_name}` -- covers
  workflow badges, action queries, discussions URL, etc.
- `{repository_namespace}.github.io/{repository_name}` -- covers the
  GitHub Pages docs site that doesn't exist before first deploy.
- `pypi.org/project/{distribution_name}` -- only generated when the
  project plans to publish, but won't exist before first release.

These are user-owned URLs -- lychee can't tell us anything we don't already
know, and they break every fresh-scaffold first commit.

Updates the README's branch protection link to a current docs page.
@ichoosetoaccept ichoosetoaccept force-pushed the ismart/dot-491-placeholder-test branch from 77fb7b7 to 5ab22c6 Compare April 16, 2026 21:26
@ichoosetoaccept ichoosetoaccept force-pushed the ismart/lychee-self-url-exclusions branch from 829e28b to 947bada Compare April 16, 2026 21:26
Base automatically changed from ismart/dot-491-placeholder-test to main April 16, 2026 21:44
@ichoosetoaccept ichoosetoaccept merged commit f8ad1ef into main Apr 16, 2026
1 check passed
@ichoosetoaccept ichoosetoaccept deleted the ismart/lychee-self-url-exclusions branch April 16, 2026 21:46
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