Skip to content

TINYDOC-3514 - Add PR-time link checking to preview workflow#4277

Draft
kemister85 wants to merge 2 commits into
tinymce/8from
hotfix/8/TINYDOC-3514
Draft

TINYDOC-3514 - Add PR-time link checking to preview workflow#4277
kemister85 wants to merge 2 commits into
tinymce/8from
hotfix/8/TINYDOC-3514

Conversation

@kemister85

Copy link
Copy Markdown
Contributor

Ticket: TINYDOC-3514

Adds the PR-time layer of automated link checking (layer 2 of 2; the scheduled full-site scan is #4276 on main). This validates only the external links a PR adds or changes in .adoc source, before merge.

How it works

A step diffs the PR against its base branch, extracts the URLs from added/changed .adoc lines, and lychee checks only those:

  • Handles AsciiDoc url[text] macros correctly (the extractor terminates at [, so the link text is not swallowed into the URL — lychee's raw .adoc reader gets this wrong).
  • Ignores xref: internal links, self-links to tiny.cloud, and bot-hostile hosts (.lycheeignore).
  • The changed link is checked once, regardless of how many pages include the partial it lives in.
  • Runs after the preview upload and is non-blocking (fail: false) at rollout — results appear in the job summary. Flip to fail: true once the baseline is clean.

Files

  • preview_create.ymlfetch-depth: 0 on checkout (needed for the diff) + extract/check steps at the end.
  • .lychee.toml, .lycheeignore — same checker config as the main PR.
  • package.jsoncheck-links script.
  • .gitignore — ignore lychee cache/report.

Validation

Verified locally with a synthetic diff covering every link form: a dead added link (commonjs.org) was flagged; a macro-form MDN link and a bare W3C link passed; xref:, a tiny.cloud self-link, and an npm (bot-hostile) link were correctly ignored.

Opened as a draft for review. The same PR-time step will be replicated to tinymce/7, /6, /5 once approved here.

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.
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