Repository navigation
ci: fail a PR that changes a published OpenAPI document - #1429
Draft
SnowboardTechie wants to merge 3 commits into
Draft
SnowboardTechie wants to merge 3 commits into
SnowboardTechie wants to merge 3 commits into
Conversation
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
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 thepublished-openapi-changelabel: the check passes but still prints the diffs.CI - Website: Check Published OpenAPI Documents(.github/workflows/ci-published-openapi.yml). It runs on PRs that touch core, the website specs,website/tspconfig.yamlor 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.website/src/scripts/check-published-openapi.ts, run aspnpm --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 afterpnpm 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.versionin the base branch'slib/core/package.json. On theCORE-v0.6.0hold branch that is still0.5.0, soopenapi.0.6.0.yamlcan change freely. When the release PR bumps core to 0.6.0, that document is covered, with nothing to update.lib/core/DEVELOPMENT.mdandlib/README.mddescribe the check and the label.Context for reviewers
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.mainrulesets 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:
origin/main, the check passes, and regenerating changes nothing..tspmodel names 0.1.0 to 0.5.0 and shows their diffs;openapi.0.3.0.yamlnames that file;openapi.0.4.0.yamlis reported as deleted.origin/CORE-v0.6.0, 0.1.0 to 0.5.0 count as released and 0.6.0 doesn't; an edit toopenapi.0.6.0.yamlpasses.checksand tests (1227) pass, as do coreciandactionlinton the workflow.Additional information
A failure looks like this (trimmed):