Skip to content

ci: fail a PR that changes a published OpenAPI document - #1429

Draft
SnowboardTechie wants to merge 3 commits into
mainfrom
bryan/1392-published-openapi-check
Draft

SnowboardTechie wants to merge 3 commits into
mainfrom
bryan/1392-published-openapi-check

Conversation

@SnowboardTechie

@SnowboardTechie SnowboardTechie commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Changes proposed

A PR that changes a released OpenAPI document in website/public/openapi/ now fails CI. The failure names each changed document and shows its diff against the base branch. If the change is deliberate, such as a description or example fix like #1342, add the published-openapi-change label: the check passes but still prints the diffs.

  • New workflow CI - Website: Check Published OpenAPI Documents (.github/workflows/ci-published-openapi.yml). It runs on PRs that touch core, the website specs, website/tspconfig.yaml or the OpenAPI documents, the tag-pruning script, or the lockfile and workspace files (a TypeSpec upgrade can change the output). It compares the PR's merge commit with that commit's first parent, the exact base the PR was merged against. It re-runs when the label is added or removed.
  • New script website/src/scripts/check-published-openapi.ts, run as pnpm --filter website run check:published-openapi --base origin/<base>. It compares each released document with the base branch twice: as committed, which catches hand edits and deletions, and after pnpm run typespec, which catches TypeSpec changes that alter older versions, the way the version errors did in [Core] Publish the ADR for API version negotiation: request mechanism #1159.
  • A document counts as released when its version is at or below the version in the base branch's lib/core/package.json. On the CORE-v0.6.0 hold branch that is still 0.5.0, so openapi.0.6.0.yaml can change freely. When the release PR bumps core to 0.6.0, that document is covered, with nothing to update.
  • lib/core/DEVELOPMENT.md and lib/README.md describe the check and the label.

Context for reviewers

  • The bundled specs under lib/cli/lib/openapi/ aren't checked. They already differ from the website copies, and fix(cli): refresh v0.4.0 and v0.5.0 base specs from core #1417 refreshes them.
  • The main rulesets don't require status checks, so this check fails a PR but doesn't block the merge unless it's made a required check.

Verified:

  • 18 unit tests for which documents count as released, the version comparison, the label override and the report.
  • Against origin/main, the check passes, and regenerating changes nothing.
  • These changes make it fail:
    • a description edit in a core .tsp model names 0.1.0 to 0.5.0 and shows their diffs;
    • a hand edit to openapi.0.3.0.yaml names that file;
    • a deleted openapi.0.4.0.yaml is reported as deleted.
  • The TypeSpec edit with the label override passes and still prints the diffs.
  • Against origin/CORE-v0.6.0, 0.1.0 to 0.5.0 count as released and 0.6.0 doesn't; an edit to openapi.0.6.0.yaml passes.
  • In a fresh worktree with this change, the website build, checks and tests (1227) pass, as do core ci and actionlint on the workflow.

Additional information

A failure looks like this (trimmed):

## Published OpenAPI documents changed

Compared with `origin/main`. Published versions: 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.5.0.

Changed: `website/public/openapi/openapi.0.1.0.yaml`, ..., `website/public/openapi/openapi.0.5.0.yaml`

To proceed, fix the TypeSpec so older versions keep their shape (versioning decorators such as `@returnTypeChangedFrom`), or, if the change is deliberate, add the `published-openapi-change` label and say why in the PR.

### `website/public/openapi/openapi.0.1.0.yaml` changed (after `pnpm --filter website run typespec`)

--- a/website/public/openapi/openapi.0.1.0.yaml
+++ b/website/public/openapi/openapi.0.1.0.yaml
@@ -859,7 +859,7 @@
-          description: Status of the opportunity
+          description: Status of the opportunity (scratch edit)

Adds a check that regenerates the website's OpenAPI documents and fails
when any document at or below core's released version differs from the
base branch, by hand or through TypeSpec. The published-openapi-change
label allows a deliberate change; the diffs still print.

Refs #1392
@github-actions github-actions Bot added website Issues related to the website core Issues related to @common-grants/core library dependencies Pull requests that update a dependency file typescript Issue or PR related to TypeScript tooling labels Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Website Preview Deployed!

Preview your changes at: https://pr-1429-common-grants.agile6.workers.dev

Built from commit 1ab800c

Checks the PR's merge commit against its first parent instead of
refetching the base branch, adds website/tspconfig.yaml to the trigger
paths, and builds the diff with one git diff call.

Refs #1392

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issues related to @common-grants/core library dependencies Pull requests that update a dependency file typescript Issue or PR related to TypeScript tooling website Issues related to the website

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Core] Add a CI check that the published OpenAPI documents don't change

1 participant