ci: automate InvokeLLM model sync from apper and scoped SDK docs PRs - #284
Open
daniellekorn wants to merge 9 commits into
Open
daniellekorn wants to merge 9 commits into
daniellekorn wants to merge 9 commits into
Conversation
Two workflows chain apper -> SDK -> docs for LLM model presets with no manual step other than merging. sync-runtime-models.yml (daily / manual) reads apper's RuntimeModel enum through the contents API and runs scripts/sync-runtime-models.mjs, which rewrites the InvokeLLMParams.model union and its Options JSDoc line in apper's declaration order. One PR on bot/sync-runtime-models is opened or updated in place while drift exists and closed if apper reverts. The script fails loudly on any anchor it cannot find rather than reporting a false "in sync". sdk-docs-scoped-pr.yml runs when that PR merges (or manually for any commit range). It regenerates the reference at the parent and the merge commit, and scripts/scoped-docs-patch.mjs applies only that diff to the published English page and every locale mirror in mintlify-docs, so the docs PR never carries unrelated unpublished regeneration drift. It refuses page additions/removals (nav update needed) and patches that do not apply cleanly, with instructions to run create-docs-local by hand. Both reuse the existing GitHub App (BASE44_GITHUB_ACTIONS_APP_ID); it must additionally be installed on base44-dev for apper (read) and mintlify-docs (write).
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/sdk@0.8.48-pr.284.344f0bcPrefer not to change any import paths? Install using npm alias so your code still imports npm i "@base44/sdk@npm:@base44-preview/sdk@0.8.48-pr.284.344f0bc"Or add it to your {
"dependencies": {
"@base44/sdk": "npm:@base44-preview/sdk@0.8.48-pr.284.344f0bc"
}
}
Preview published to npm registry — try new features instantly! |
The scoped docs workflow is not model-specific: any SDK commit range can be published on its own, and a future connectors sync would only add its branch to the trigger condition. Name it for what it does. Add vitest coverage for both scripts so the PR's own CI proves them: sync-runtime-models (enum parsing incl. docstring/comments/quotes, anchor detection against the real integrations.types.ts, drift rewrite, idempotence, every refusal path) and scoped-docs-patch (apply to English + locale mirrors, dry run, conflict refusal, missing locale, ignored README, page add/remove refusal, bad target). Scripts now run main() only when executed directly so tests can import them.
The scripts now always come from the branch the workflow runs on; only the reference regeneration checks out the target commits.
The org's Actions policy blocks peter-evans/create-pull-request (the workflow failed at startup until the step was removed). The local action commits the listed paths without moving HEAD, force-pushes the branch, and creates, updates, leaves alone, or closes the PR.
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.
What
Automates drift check 1 (LLM model presets) end to end, plus the docs half of it, with no manual step other than merging:
.github/workflows/sync-runtime-models.ymlruntime_model_config.pyfrom apper via the contents API, runs the sync script, opens or updates one PR onbot/sync-runtime-models. The PR closes itself if apper reverts.scripts/sync-runtime-models.mjsInvokeLLMParams.modelunion and itsOptions:JSDoc line in apper's declaration order. Fails loudly if the enum class, theautomaticmember, either anchor line, or a sane model count is missing..github/workflows/publish-sdk-change-to-docs.ymlbot/sdk-docs/<sha>. Not model-specific: a future connectors sync only adds its branch to the trigger condition.scripts/scoped-docs-patch.mjsdocs.json) and patches that do not apply cleanly, with instructions to fall back tocreate-docs-local..github/actions/open-or-update-pr/peter-evans/create-pull-request, which the org's Actions policy blocks (see below).tests/unit/sync-runtime-models.test.ts,tests/unit/scoped-docs-patch.test.tsThe docs PR is deliberately scoped: it never carries unrelated unpublished regeneration drift. Full regeneration stays a manual
create-docs-localrun.How to review
scripts/sync-runtime-models.mjs: header, thenparseRuntimeModelsandparseTarget.scripts/scoped-docs-patch.mjs: header, thenmain. The core is onegit diff --no-indexand onegit apply -p2 --directory=...per locale..github/actions/open-or-update-pr/open-or-update-pr.sh: ~50 lines of bash. The commit is built withwrite-tree/commit-treeso HEAD never moves.test(...)title states a guarantee.create-github-app-tokenblocks.Verified on this PR (temporary
pull_requesttriggers, see below)peter-evans/create-pull-request. Removing that step was the only change that made them start.base44-dev/apper. Expected until the install below.npm ci, commit-range resolution and regeneration pass; then the same token failure formintlify-docs.Verified locally: both scripts against the real apper file and real mintlify-docs tree; the PR action's script against a scratch remote (create / unchanged / update / close / stale-branch cleanup / deletions / misspelled pathspec fails loudly);
actionlint+shellcheck,eslint,check_wix_proxy_steps.py, full unit suite.Setup required before the first real run
No new IDs or secrets. Both workflows reuse
vars.BASE44_GITHUB_ACTIONS_APP_IDandsecrets.BASE44_GITHUB_ACTIONS_APP_PRIVATE_KEY, i.e. the Base44 Github Actions App (base44-github-actions[bot]). An org admin needs to:apperandmintlify-docs.Before merging
Revert the commits marked
TEMP(they addpull_requesttriggers for verification). Everything else stays.How to test after merging
main: expect "already matches", PRnone.6759819348a0f4588d48a5355b064f26ba3e2735(apper still hadgpt_5_5): expect a real PR onbot/sync-runtime-modelswith CI on it. Do not merge. Re-run withmain: the PR closes itself.head_sha=c26f065: expect a mintlify-docs PR touching exactly 8 files (createClient page, English + 7 locales). Genuinely unpublished, safe to merge.head_sha=f03e949: expect a failed run at the apply step, no PR. Already published; red is correct.Known behaviours
base44-github-actions[bot]but are not signed (no "Verified" badge). If a target branch requires signed commits, the push will be rejected visibly.allowed_botslists if unwanted.actions/checkout@v4andactions/setup-python@v6by tag, and the org policy appears to require SHA pins. Worth its own PR.