Files
ersatztv/scripts/update-openapi.sh
T
timothyandClaude Opus 4.8 be9cf5f381
Build ErsatzTV Image / decisions.md append-only (pull_request) Successful in 7s
Build ErsatzTV Image / Docs update reminder (pull_request) Successful in 8s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 4m32s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 5m37s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 2m0s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 2m44s
fix(ci): build before GenerateOpenApiDocuments in update-openapi.sh
The new api-docs gate (#303 H4/H5) runs update-openapi.sh after only `dotnet
restore`. The script's `dotnet build -t:GenerateOpenApiDocuments` does not compile
the project (OpenApiGenerateDocumentsOnBuild=false), so in a clean tree getdocument
fails with 'ErsatzTV.deps.json does not exist' (exit 129). This PR is the first to
change the /api surface and thus the first to exercise the gate's regen path,
exposing the latent bug. Add a full `dotnet build` before the doc-gen target so the
assembly + deps.json exist. Verified: clean-tree regen now succeeds with zero diff.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-12 21:50:42 +02:00

18 lines
855 B
Bash
Executable File

#! /usr/bin/env bash
cd "$(git rev-parse --show-toplevel)" || exit
REPO_ROOT="$(pwd)"
# Only regenerate the endpoint index if the spec build succeeded, so a failed
# build can't render docs/endpoint-index.md from a stale/partial v1.json.
#
# A full `dotnet build` MUST run before the doc-gen target: OpenApiGenerateDocumentsOnBuild
# is false, so `-t:GenerateOpenApiDocuments` alone does NOT compile the project — it invokes
# dotnet-getdocument against ErsatzTV.dll + ErsatzTV.deps.json, which don't exist in a clean
# tree (e.g. the CI api-docs job, which only restores). Without the build the target fails with
# "The specified deps.json … does not exist" (exit 129). Build first, then generate.
(cd ErsatzTV && dotnet build && dotnet build -t:GenerateOpenApiDocuments) || exit
cd "$REPO_ROOT" || exit
python3 scripts/generate-endpoint-index.py