Repository navigation
Check the links of the built docs site and the package READMEs in docs.yml - #330
Merged
Merged
Conversation
…s.yml docsite/tools/check-links.ps1 reads every page of the built site and the six README files. An internal page, file or anchor that does not resolve fails the run, as does a README link that is not absolute. A README link into this repository's master branch is checked against the checkout (so a file added in a pull request is found before it merges), and every lookup is case-sensitive, as on GitHub Pages. An external link fails the run only on a hard 404 or 410; a timeout or a refusal is listed and not failed. Slide links (#N) in the presentation are checked against the slide count, preconnect hints are not links, and API-page links to learn.microsoft.com (generated by DocFX) are skipped. The check is a small PowerShell script rather than a third-party action: it needs no pinned external dependency, runs the same locally and in CI, and knows the three site-specific cases above. It found no broken link in the current tree (626 pages, 17742 links, 13 external). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e dead anchor found The link check now also looks up the heading of a README link into this repository's master branch (GitHub's heading ids), and found one real dead link: the root README sent "Trimming and native AOT" to a heading that Source/Core/README.md does not have. It now links to the article that holds the section. Review of the checker (three reviewers, arbitrated): a README link into the repository's root, a different case of the owner name, an extensionless published URL, a URL with parentheses, an indented code fence and an angle-bracket reference definition are read correctly; an id on a meta tag no longer counts as an anchor; external requests wait 10 seconds at most, retry only a timeout or a 5xx, and stop after 5 minutes in total, so a network fault cannot stall a deploy. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…, not on the network On a pull request DocFX writes its "View source" links with the ref the build ran on (github.com/.../blob/330/merge/Source/...), a ref that is not a branch, so the external check found 69 hard 404s on the first CI run. The local build has no such links. A link into this repository on GitHub whose ref is master, or <number>/merge, or <number>/head is now looked up among the files git tracks, as a link to master already was. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…nked image, keep a HEAD 404, and five smaller fixes - A linked image such as [](target) had its target never checked (the pattern needed a "[" before each "](...)"); both halves are checked now. - A HEAD that answered 404 followed by a GET that timed out reported the link as not confirmed; the 404 now stays. - A heading with an underscore inside a word (Pool_clearing) keeps it in its GitHub anchor. - A README HTML tag with a single-quoted href or src is read. - Without git on the PATH the script stops with a clear message (the files of the repository are the ones git tracks; the disk fallback ignored case on Windows). - The published site's address without its trailing slash is the site, not an external link. - The script requires PowerShell 7. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wave 2, PR 1 of 2: a link check over the built docs site and the six README files, run by
docs.yml.What it does
docsite/tools/check-links.ps1reads every page of the built site (626 pages, 17,742 links today) and the root and five package READMEs.#N) in the presentation are checked against the slide count.masterbranch is checked against the checkout (so a file added in a pull request is found before it merges), and its#headingagainst GitHub's heading ids.preconnectanddns-prefetchhints. Skipped: API-page links tolearn.microsoft.com(DocFX generates them from the framework's cross-reference map).docsite/CONTRIBUTING-DOCS.mdsays so, with the local command.Why a script and not an action such as lychee: no external dependency to pin and keep current, the same command runs locally and in CI, and the three site-specific cases above (slide numbers, case sensitivity, README links into this repository) need code a generic tool would not have.
What it found
One dead link: the root README sent "Trimming and native AOT" to
Source/Core/README.md#trimming-and-native-aot, a heading that file does not have (it is a bullet). It now links to the article section,articles/mapping.html#trimming-and-native-aot. No other broken page, file, anchor or external link in the site or the six READMEs.Evidence
#40of 39, a 404 external link. A repository-root link, an owner name in another case, an extensionless site URL, a URL with parentheses, an indented code fence and an angle-bracket reference definition are read correctly.idand<a name>, bounded external requests, README heading check. Not applied: README-like files outside the six (CONTRIBUTING.md,Benchmarks/RESULTS.md),index.json/sitemap.xmlentries (they list the same pages), CSS/SVGurl()(none today).Second review (owner-requested swarm, run by the PM session: four Haiku lenses and a Sonnet arbiter), and the first CI run
Not covered
docs.ymlhas not run on GitHub with this step yet; it runs on this PR..htmlpages and the six READMEs are scanned (see not applied above).🤖 Generated with Claude Code