Skip to content

ci: docs link check for learning/ (OPS-71) - #37

Merged
iman-nebulr merged 1 commit into
mainfrom
docs/ops-71-link-check
Oct 9, 2026
Merged

iman-nebulr merged 1 commit into
mainfrom
docs/ops-71-link-check

Conversation

@iman-nebulr

Copy link
Copy Markdown
Contributor

Adds the docs link check that the other SDK repos get in OPS-71, so a broken link in learning/ is caught before it reaches the website. learning/ on main has no broken links today, so there are no link fixes here.

Docs link check (approved by the owner)

scripts/check-docs-links.mjs: dependency-free node, about 0.05 s. It checks every link in learning/ the way the docs sync publishes it to thebridge.dev/docs:

  • relative .md links: the file exists, any #anchor matches a heading, and the link is a form the sync rewrites to that file's own page (the sync cannot rewrite a link naming two or more folders);
  • site paths (/auth/config/, /docs/...): a real docs page, from scripts/docs-site-pages.txt (regenerate with --print-site-pages <bridge-web>/bridge-docs/src/content/docs) plus the pages this repo's own learning/ produces;
  • #anchors on the same page, and two files publishing to the same page.
    README.md files are skipped (the sync does not publish them).

Where it runs:

  • .github/workflows/docs-links.yml: pull requests to main touching learning/ or the checker. A separate workflow; build, test and publish jobs are unchanged.
  • sync-docs-only.yml: a step before the sync, so a broken link stops the sync instead of reaching the website.
  • Before push: .githooks/pre-push, through the shared hook's opt-in (git config workflows.localPrePush .githooks/pre-push; undo with git config --unset workflows.localPrePush). Runs only when a pushed commit touches learning/ or the checker, and checks the pushed commit, not the working tree. Skip once: SKIP_LINK_CHECK=1 git push.
  • Locally: node scripts/check-docs-links.mjs (or check:docs-links in package.json).

Merging to main does not change docs, so it does not trigger a docs sync. Not merged by the author.

Refs: OPS-71

…sync and before push (OPS-71)

scripts/check-docs-links.mjs (dependency-free node, about 0.05 s) checks every link in learning/ the way the docs sync publishes it to thebridge.dev/docs: relative .md links must point at an existing file and heading, and must be a form the sync rewrites to that file's own page; site paths like /auth/config/ must be real docs pages (scripts/docs-site-pages.txt, plus the pages this repo's own learning/ produces); #anchors must match a heading; two files must not publish to the same page.

It runs in three places:
- the Docs links workflow, on pull requests to main that touch learning/ or the checker (separate from build, test and publish);
- the Sync Docs workflow, before the sync, so a broken link never reaches the website;
- before push, via .githooks/pre-push, when a pushed commit touches learning/. Opt in per checkout with: git config workflows.localPrePush .githooks/pre-push

Refs: OPS-71
@iman-nebulr
iman-nebulr merged commit 6abb2c6 into main Oct 9, 2026
9 checks passed
@iman-nebulr
iman-nebulr deleted the docs/ops-71-link-check branch October 9, 2026 08:52
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