Skip to content

ci: refresh the committed Weaviate OpenAPI spec automatically - #518

Merged
g-despot merged 1 commit into
mainfrom
ci/openapi-spec-refresh
Aug 17, 2026
Merged

ci: refresh the committed Weaviate OpenAPI spec automatically#518
g-despot merged 1 commit into
mainfrom
ci/openapi-spec-refresh

Conversation

@g-despot

Copy link
Copy Markdown
Contributor

Keeps static/specs/weaviate-openapi.json current without anyone remembering to. Weekly (Sunday 21:00 UTC, offset from the existing scheduled jobs), it resolves the newest v*/openapi-for-docs branch in weaviate/weaviate, downloads openapi-specs/schema.json, and opens a PR only when the bytes differ — with the info.version and path-count delta in the body, so the change is reviewable without diffing 11,000 lines. Weekly because upstream only moves when core cuts a release branch, roughly every 6-8 weeks.

Two things a reviewer cannot see in the diff:

  1. This needs "Allow GitHub Actions to create and approve pull requests" enabled (Settings → Actions → General, repo or org level). It uses the built-in GITHUB_TOKEN rather than a PAT — one less secret to rotate, and an expired PAT has already broken a version-fetch job here — but without that setting the final step fails with a 403. Nothing in this repo opens PRs from CI today, so assume it is off until checked.
  2. A push made with GITHUB_TOKEN does not trigger other workflows. The PR this job opens will arrive with no build or link checks having run. Close and reopen it to run them before merging. The PR body says so too.

Merge after the PR that adds static/specs/weaviate-openapi.json — this job reads that file to compute the delta and fails if it is not there.

Verified locally: both paths dry-run against the live GitHub API (no-op when identical; correct 1.38.0-rc.0/73 → 1.39.0/77 delta when not), YAML parses, all run blocks pass bash -n and shellcheck. The version sort is numeric on (major, minor), since v1-9 sorts above v1-10 lexically. The scheduled run itself cannot be exercised before merge — schedule and workflow_dispatch only fire from the default branch.

static/specs/weaviate-openapi.json is a committed copy of a file that lives in
weaviate/weaviate. Nothing in this repo notices when it falls behind, because a
stale-but-valid spec looks exactly like a fresh one — so the site can keep
publishing an old API contract indefinitely, and the only thing preventing that
is someone remembering.

Add a weekly job that resolves the newest v*/openapi-for-docs branch upstream,
downloads openapi-specs/schema.json, and opens a PR only when the bytes differ,
with the info.version and path-count delta in the body so the change is legible
without diffing 11,000 lines. Branch selection sorts on (major, minor)
numerically, because v1-9 sorts above v1-10 lexically. The download is validated
as a Swagger document with a non-empty paths object before anything is written,
so a rate-limit page cannot be committed over the spec.

It uses the built-in GITHUB_TOKEN rather than a PAT: a PAT is one more secret to
rotate, and an expired one has already broken a version-fetch job in this repo.
That trade needs "Allow GitHub Actions to create and approve pull requests"
enabled for the repository, or the final step fails with a 403.

Merge this after the PR that adds static/specs/weaviate-openapi.json — the job
reads that file to compute the delta, and fails if it is not there yet.

@orca-security-eu orca-security-eu Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@g-despot
g-despot merged commit 2c5db55 into main Aug 17, 2026
13 checks passed
@g-despot
g-despot deleted the ci/openapi-spec-refresh branch August 17, 2026 12:07
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