Skip to content

TINYDOC-3514 - Add external link checking to pull requests /latest - #4277

Merged
kemister85 merged 9 commits into
tinymce/8from
hotfix/8/TINYDOC-3514
Aug 31, 2026
Merged

kemister85 merged 9 commits into
tinymce/8from
hotfix/8/TINYDOC-3514

Conversation

@kemister85

@kemister85 kemister85 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Ticket: TINYDOC-3514

Site: Staging (CI-only change; no page content differs)

Adds a Link Check workflow that checks external links a pull request has added or changed. A broken link fails the check and applies the link-rot label; pushing a fix clears both on the next run. It does not block merging — the check is not required.

Links are read from the built HTML rather than the .adoc diff, so URLs in [source] blocks and build-time attributes cannot reach the checker. The diff only narrows which rendered anchors get checked. It is a separate workflow so a link problem is never reported as a failed deployment; preview_create.yml is untouched.

Changes:

  • Added .github/workflows/link-check-pr.yml.
  • Added .lychee.toml and .lycheeignore (redirects and rate limiting treated as healthy; bot-hostile hosts curated per URL rather than blanket-accepting 403).
  • Added a check-links script to package.json and cache/report output paths to .gitignore.

Note: verified in CI on throwaway pull requests — broken link fails and labels, fix clears both, no changed links skips the build. A dead URL inside a [source,js] block was among the diff candidates and correctly excluded on both runs. Follow-up: replicate to main, tinymce/7, /6 and /5 once exercised in production.


Pre-checks:

  • Branch is correctly prefixed: hotfix/8/TINYDOC-3514
  • Build passes without console errors, warnings, or issues.

Review:

  • Documentation Team Lead has reviewed.

Validate the external links a PR adds or changes in .adoc source before
merge. A step extracts URLs from the PR diff (handling AsciiDoc url[text]
macros, ignoring xref internals and self-links) and lychee checks only
those, so the changed link is verified once regardless of how many pages
include it.

- preview_create.yml: fetch full history for the diff; add extract +
  check steps after the preview upload (non-blocking, fail: false)
- .lychee.toml / .lycheeignore: checker config and curated ignore list
- package.json: check-links script for local use
- .gitignore: ignore the local lychee cache and report output
grep -c on an empty changed-links.txt printed 0 and exited 1, so the
fallback also fired and wrote a stray line to GITHUB_OUTPUT (Invalid
format). Use wc -l, which returns a single value and exits cleanly.
@kemister85
kemister85 force-pushed the hotfix/8/TINYDOC-3514 branch from 7d7002f to 811caf6 Compare August 20, 2026 02:18
Narrows the PR-time check from a full ~410-URL crawl of the built site to the
links the pull request actually changed. lychee --dump lists rendered anchors
without making any requests, so the built-HTML guarantee is unchanged; only the
intersection with the diff is checked over the network.

Also restores the on-disk request cache, which the config asks for but which had
no effect on a clean runner, and tightens the timeout and retry budget for the
PR-time run via CLI flags so .lychee.toml stays identical to the scheduled scan.
lychee-action@v2 is a floating major tag, so its default checker version can move
without a change here. Pin it explicitly in both steps to keep results
reproducible.
A broken link now fails its own required-able status check instead of printing a
warning on a green preview run.

The check moves out of the preview deployment workflow into a separate one, so a
link problem is never reported as a failed deployment and infrastructure
flakiness in the deploy path cannot block merges. preview_create.yml is left
byte-identical to the base branch.

The check builds only the current branch, since the published versions are the
deploy pipeline's concern. It fails closed when the checker produces no report,
and only considers links the pull request touched: blocking on pre-existing rot
would make the gate unmergeable.
The label is applied when a run finds broken links and removed as soon as a later
run comes back clean, so it clears itself when the author pushes a fix.

Reporting, labelling and failing are now separate steps: a single step that
exited non-zero would skip its own labelling, leaving the label stale on exactly
the runs that matter. Nothing is changed when the checker could not verify the
links, since the absence of a result is not evidence that the links are healthy.

Labelling is best-effort so that a fork's read-only token cannot turn a missing
label into a failed check that hides the real result.
@kemister85 kemister85 changed the title TINYDOC-3514 - Add PR-time link checking to preview workflow TINYDOC-3514 - Add external link checking to pull requests Aug 30, 2026
@kemister85
kemister85 requested review from a team, ShiridiGandham, TheSpyder, kimwoodfield, metricjs and shanmen-tiny and removed request for a team August 31, 2026 00:14
Only the playbooks that set latest_version_segment produce
build/site/tinymce/latest; tinymce/6 and tinymce/5 produce build/site/tinymce/6
and build/site/tinymce/5. A glob that matches nothing is only a lychee [WARN], so
the check would have passed silently on those branches while verifying nothing.
@kemister85
kemister85 marked this pull request as ready for review August 31, 2026 00:31
@kemister85
kemister85 requested review from a team and soritaheng as code owners August 31, 2026 00:31
@kemister85 kemister85 changed the title TINYDOC-3514 - Add external link checking to pull requests TINYDOC-3514 - Add external link checking to pull requests /latest Aug 31, 2026
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.

3 participants