repomatic.lint_repo.site module¶
Checks of the site deployment: GitHub Pages and Cloudflare Pages.
The GitHub Pages source and the redirect of its legacy URLs, the Cloudflare
credentials, the _redirects files as the Pages engine reads them, the
wrangler.toml file, the files over the Pages size limit, whether the Sphinx
build stops a dead fragment link before it publishes, and the title octicon of
each docs page.
- repomatic.lint_repo.site.API_PAGE_TITLE_RE = re.compile('^# `?[\\w.]+`? (?:module|package)$')¶
The title
sphinx-apidocgives a generated module page.Such a page keeps a plain title: the sidebar marks the generated entries with
SIDEBAR_OCTICONSinstead.
- repomatic.lint_repo.site.FAIL_ON_WARNINGS_CONFIG = 'click_extra_fail_on_warnings'¶
The
conf.pyvalue listing the warning types that fail a Sphinx build.click-extra’s Sphinx extension reads it, with the syntax of
suppress_warnings:mystcovers every subtype,myst.xref_missingonly that one. Named here rather than imported, because click-extra’s Sphinx modules import Sphinx.
- repomatic.lint_repo.site.FAIL_ON_WARNINGS_EXTENSIONS = frozenset({'click_extra.sphinx', 'click_extra.sphinx.fail_on_warnings'})¶
The extensions that register
FAIL_ON_WARNINGS_CONFIG.Sphinx ignores a
conf.pyvalue that no loaded extension registers.
- repomatic.lint_repo.site.FRAGMENT_LINK_WARNING_TYPES = frozenset({'myst', 'myst.xref_missing'})¶
The warning types that cover a fragment link myst-parser cannot place.
An entry of
suppress_warningsorFAIL_ON_WARNINGS_CONFIGnames either the wholemysttype or itsxref_missingsubtype.
- repomatic.lint_repo.site.MAX_REPORTED_DEAD_URLS = 5¶
How many abandoned redirect sources a failing
_redirectscheck names.Enough to recognize which part of the file fell off the end, short of dumping a tail that can run to hundreds of rules into one lint message. The remainder is counted rather than listed, and the fix is the same reorder either way.
- repomatic.lint_repo.site.OCTICON_REGISTRY_FILE = 'octicons.toml'¶
The bundled data file
OcticonRegistryreads.
- repomatic.lint_repo.site.PAGES_DEPLOYMENT_SOURCE: Final = RepoSettingProbe(label='Pages deployment source check', endpoint='pages', field='build_type', pass_message='GitHub Pages deployment source is set to GitHub Actions.', fail_message="GitHub Pages deployment source is set to 'Deploy from a branch'. Change it to 'GitHub Actions' under https://github.com/{repo}/settings/pages so the docs.yaml workflow can deploy.", passing=frozenset({'workflow'}), failing=frozenset({'legacy'}), unknown='unknown build_type {value!r}', unavailable='Pages not configured or API inaccessible')¶
The GitHub Pages
build_type, read bycheck_pages_deployment_source().
- repomatic.lint_repo.site.SIDEBAR_OCTICONS = frozenset({'code-review', 'codescan-checkmark', 'list-unordered', 'package'})¶
The octicons the sidebar draws beside the entries that Sphinx generates.
The
custom.csstoctree rule of thesphinx-docsagent marks the package page, thetestspage,genindexandmodindexwith them. A page title that takes one reads as one of those entries.
- repomatic.lint_repo.site.TITLE_OCTICON_RE = re.compile('^# \\{octicon\\}`(?P<icon>[^`;]+)')¶
An octicon role that opens a page title, without its size and class options.
- repomatic.lint_repo.site.check_pages_deployment_source(ctx)[source]¶
Check that GitHub Pages is deployed through GitHub Actions, not a branch.
The
docs.yamlworkflow usesactions/upload-pages-artifactandactions/deploy-pages, which require the Pages source to be set to GitHub Actions in the repository settings. Branch-based deployment (legacy) is incompatible.Note
A 404 means Pages is not configured at all. This is treated as indeterminate (
None) rather than a failure, because the repository may not have deployed docs yet.- Return type:
- repomatic.lint_repo.site.check_pages_redirect_preserved(ctx)[source]¶
Check that the old
github.ioURLs still redirect to the live site.A repository whose site moved to Cloudflare Pages keeps its
<owner>.github.io/<repo>/…URLs answering through a single field: the GitHub Pages custom domain. Set it, and GitHub redirects that whole space with a path-preserving301, for free, covering paths the site never even had. What it rescues is precisely the set of URLs nobody can rewrite: search indexes, other projects’ readmes, and the[project.urls]metadata frozen into every release already published.Two ways to lose it, both invisible from inside the repository. Disabling Pages deletes the redirect along with the site, and every historical link starts answering
404with nothing to show a maintainer why. Leaving the custom domain unset is quieter still: the old host keeps serving a copy of the documentation, which stops being rebuilt the moment the deploy job is gated off, so the two hosts disagree more with every release.- Return type:
- Returns:
A
CheckResult.passedisNonewhen the repository has no legacy Pages URLs to preserve, or the declared URL is unreadable.
- repomatic.lint_repo.site.check_stale_gh_pages_branch(ctx)[source]¶
Check for a leftover
gh-pagesbranch after switching to GitHub Actions.When Pages is deployed through GitHub Actions, the
gh-pagesbranch is no longer needed and should be deleted to avoid confusion.- Return type:
- repomatic.lint_repo.site.check_sphinx_fragment_links(ctx)[source]¶
Check that the Sphinx build fails on a fragment link that lands nowhere.
myst-parser resolves each
`text <#anchor>`_and`text <page.md#anchor>`_link against what the build produced. For a link it cannot place, it logs amyst.xref_missingwarning and ships the link as written, and Sphinx still exits 0. The Docs workflow runs no anchor check of its own, so onlyFAIL_ON_WARNINGS_CONFIGstops the dead link before it publishes. Asuppress_warningsentry for the type defeats it: click-extra skips a suppressed warning.- Return type:
- class repomatic.lint_repo.site.OcticonRegistry(icons, families)[source]¶
Bases:
objectThe title octicon of each hand-written docs page.
One registry covers every repository that follows the conventions of the
sphinx-docsagent, so an octicon keeps one meaning across their sites. The agent carries the registry as a table, whichmarkdown_table()renders.Todo
Review the octicon of each page once a sphinx-design release carries executablebooks/sphinx-design#309, which adds 81 icons to the 328 of
0.7.0, likeagent,ai-modelandflowchart. Adopt a new icon only once thedocsdependencies of every site that takes it require that release:0.7.0reports an error on an icon it does not know, and renders the role as plain text.- icons: dict[str, tuple[str, ...]]¶
The page patterns of each octicon, in the order of the file.
A pattern is a page file name or a glob of them, like
cli-*.md.
- families: dict[str, tuple[str, ...]]¶
The page patterns that one repository may give the same octicon.
A family documents one feature, so a reader scans its pages as a group rather than tells them apart by icon.
- classmethod load()[source]¶
Read the registry from the bundled
OCTICON_REGISTRY_FILE.- Return type:
- repomatic.lint_repo.site.check_title_octicons(ctx)[source]¶
Check the title octicon of each docs page against
OcticonRegistry.Furo shows the title octicon of a page in the sidebar, where a reader finds the page by it. The icon helps only while it names one kind of page across the sites, and one page per site. A generated module page keeps a plain title. A page with no
#title, like anindex.mdthat includes the readme, has no title to check.- Return type:
- repomatic.lint_repo.site.check_cloudflare_secrets(ctx)[source]¶
Report whether the Cloudflare Pages deploy has the credential it needs.
One secret, and no identifier beside it: the account is derived from the token at run time, since an account-owned token holding Cloudflare Pages: Edit and nothing else still enumerates the account it belongs to, measured on 2026-08-16 against a
cfat_token with exactly that scope. The token is the whole of the authentication surface.- Return type:
- repomatic.lint_repo.site.check_cloudflare_r2_secrets(ctx)[source]¶
Report whether the offload can upload to the declared R2 bucket.
Without the key pair the deploy still publishes, but it drops every file over the Pages limit: the very files the bucket was declared to serve. The pair is limited to that bucket, which Cloudflare allows on the S3 API only, so
CLOUDFLARE_API_TOKENcannot stand in for it.- Return type:
- repomatic.lint_repo.site.check_pages_redirects(ctx)[source]¶
Audit every committed
_redirectsfile the way the Pages engine reads it.The engine’s budget accounting is undocumented and its failures are silent:
wrangler pages deployprints nothing when the parser drops a rule or abandons the file, and a dead redirect looks exactly like a URL nobody visits. One site carried 18 dead rules for years this way. The replica inrepomatic.cloudflare.redirectsreports here what production would do.- Return type:
- repomatic.lint_repo.site.check_wrangler_config(ctx)[source]¶
Check the committed
wrangler.tomlagainst the declared Cloudflare state.The file only matters to local
wranglercommands on a Direct Upload project, but it can still contradict the repository’s declared state in two places Cloudflare will not reconcile for anyone: the project name the CI deploy targets, and the compatibility date the live project honours server-side. One value sat three years behind the live one this way, because nothing read it.- Return type:
- repomatic.lint_repo.site.check_oversized_site_files(ctx)[source]¶
Warn about tracked files the Cloudflare Pages deploy cannot upload.
Direct Upload rejects any file over the Pages limit. The deploy drops such a file unless an R2 bucket takes it, and a dropped file leaves a dead link. No setting names the site’s sources, so the check reads every tracked file: a large file outside the site is a false alarm, which is why this warns and never fails.
- Return type: