Skip to content

ci: comment the public API diff on PRs (informative)#8848

Merged
kpal81xd merged 1 commit into
mainfrom
feature-api-surface-report
Jun 8, 2026
Merged

ci: comment the public API diff on PRs (informative)#8848
kpal81xd merged 1 commit into
mainfrom
feature-api-surface-report

Conversation

@kpal81xd

@kpal81xd kpal81xd commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Posts an informative, non-blocking comment on each PR showing how it changes the public API
surface — sourced from TypeDoc, so it follows the exact rules the docs site uses
(excludeNotDocumented, @ignore, @private, the utils/typedoc plugin). Internal / ignored /
undocumented symbols never appear (e.g. the @ignored app global is excluded).

A pull_request workflow builds a full-signature API surface for the PR head and its base,
diffs them, and posts/updates a sticky comment.

Item Detail
Source of truth typedoc --json (same config + plugin as npm run docs) → respects the docs' public-API rules
Serializer utils/api-surface.mjs turns the TypeDoc model into a stable, sorted, fully-qualified, full-signature surface (e.g. Vec3.add(rhs: Vec3): Vec3)
Detail full signatures — catches added/removed symbols and signature/type changes
Blocking? No — comment step is continue-on-error
Footprint 2 files: utils/api-surface.mjs + .github/workflows/api-report.yml

Why not api-extractor: it keys off release tags (@public/@internal) and includes every
export in the .d.ts (marking undocumented ones), so it can't honour @ignore / @private /
excludeNotDocumented — which this engine uses (323 @ignore, 233 @private, 0 @internal).
TypeDoc already implements those rules, so the report is built from its model.

Example

When a PR changes the public surface, the bot posts/updates one sticky comment. Example from a live
test on this PR (a temporary documented export, since reverted):

Public API report

This PR changes the public API surface (+1 / −0), per the docs' rules (@ignore / @Private / undocumented are excluded).

+const API_REPORT_SMOKE_TEST: 42

When nothing changes it instead says: ✅ No public API changes in this PR.

Forks

Comments directly, which needs a write token — granted only for same-repo branches. Fork PRs get a
read-only token, so the comment step is skipped (continue-on-error, so the run stays green without
a comment). Full fork coverage would need the workflow_run split, which can't run from a branch
before merging.

Cost

Two typedoc --json runs per PR (head + base) — heavier than a unit job, but it's informational and
never gates merges.

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

Public API report

✅ No public API changes in this PR.

@kpal81xd kpal81xd force-pushed the feature-api-surface-report branch from 8d767a7 to 4423c3e Compare June 5, 2026 14:22
@kpal81xd kpal81xd force-pushed the feature-api-surface-report branch from 4423c3e to 48effef Compare June 5, 2026 14:32
@kpal81xd kpal81xd force-pushed the feature-api-surface-report branch from 48effef to 6998e2e Compare June 5, 2026 14:34
@kpal81xd kpal81xd force-pushed the feature-api-surface-report branch from 6998e2e to ab97abd Compare June 5, 2026 14:44
@kpal81xd kpal81xd force-pushed the feature-api-surface-report branch from ab97abd to 1516dd0 Compare June 5, 2026 14:50
@kpal81xd kpal81xd force-pushed the feature-api-surface-report branch from 1516dd0 to 9973351 Compare June 5, 2026 14:52
A pull_request workflow builds a full-signature view of the public API for the
PR head and its base from TypeDoc's --json model, diffs them, and posts/updates
a sticky comment. Sourcing from TypeDoc means it follows the docs' public-API
rules (excludeNotDocumented, @ignore, @Private, the typedoc plugin), so internal
or ignored symbols never appear in the report. Never fails the build.

- utils/api-surface.mjs: serialises the TypeDoc JSON model into a stable, sorted,
  fully-qualified, full-signature surface for diffing.
- .github/workflows/api-report.yml: builds the base + PR surfaces, diffs them,
  and posts/updates the sticky comment (continue-on-error so fork PRs stay green).
@kpal81xd kpal81xd force-pushed the feature-api-surface-report branch from 59c34b0 to 71d5352 Compare June 8, 2026 08:49
@kpal81xd kpal81xd merged commit 0d3961a into main Jun 8, 2026
9 checks passed
@kpal81xd kpal81xd deleted the feature-api-surface-report branch June 8, 2026 08:51
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