Skip to content

Commit 251f338

Browse files
committed
fix(ci): resolve baseUrl in docs link check
The Validate links step ran hyperlink against docs/build directly, but the site baseUrl is /javascript/, so every internal link is emitted as /javascript/... . hyperlink treats the target dir as server root, so those site-absolute links resolved to a nonexistent /javascript prefix and produced ~21k false 'bad link' errors (0 bad anchors). Stage the build under a javascript/ subdir and point hyperlink at the parent so links resolve. Also drop --sources (reporting-only, does not affect pass/fail) and gitignore the _linkcheck scratch dir.
1 parent d188158 commit 251f338

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

.github/workflows/deploy-docs-v2.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,15 @@ jobs:
2727
run: npm run build
2828
working-directory: docs
2929
- name: Validate links and anchors
30-
run: npx @untitaker/hyperlink docs/build --check-anchors --sources docs/docs
30+
# Docusaurus baseUrl is /javascript/, so all internal links are emitted
31+
# as /javascript/... . hyperlink treats the given dir as server root "/",
32+
# so the build must be staged under a matching javascript/ subdirectory
33+
# for site-absolute links to resolve.
34+
run: |
35+
rm -rf _linkcheck
36+
mkdir -p _linkcheck/javascript
37+
cp -R docs/build/. _linkcheck/javascript/
38+
npx @untitaker/hyperlink _linkcheck --check-anchors
3139
- name: Deploy to gh-pages
3240
if: github.event_name == 'push'
3341
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ docs/*
1818
# Docusaurus
1919
website/.docusaurus
2020
website/build
21-
website/node_modules
21+
website/node_modules
22+
23+
# Link-check scratch dir (created by docs CI to stage build under baseUrl)
24+
_linkcheck/

0 commit comments

Comments
 (0)