Fold openapi.json auto-sync into main CI test job

The separate openapi-sync workflow was duplicating the workspace build
(~15 min cold-cache compile), paying the cost twice per PR. Fold the
regen + auto-commit into the existing test job: one compile, shared
rust-cache, same drift-check semantics.

- Same-repo PRs: OMNIGRAPH_UPDATE_OPENAPI=1 during the test run, then
  commit the regenerated spec back to the PR branch
- Fork PRs / pushes: env var empty, test stays in strict drift-check mode
- openapi_spec_is_up_to_date treats empty env value as unset, so the
  conditional workflow env expression works

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ragnor Comerford 2026-04-18 21:00:46 +02:00
parent 9de2079263
commit a157f6a17c
No known key found for this signature in database
3 changed files with 42 additions and 64 deletions

View file

@ -971,7 +971,10 @@ fn openapi_spec_is_up_to_date() {
let generated = serde_json::to_string_pretty(&openapi_doc()).unwrap() + "\n";
if env::var("OMNIGRAPH_UPDATE_OPENAPI").is_ok() {
if !env::var("OMNIGRAPH_UPDATE_OPENAPI")
.unwrap_or_default()
.is_empty()
{
fs::write(&spec_path, &generated).unwrap();
return;
}