Skip to content

chore: automate AI model catalog sync#32057

Draft
adriandlam wants to merge 1 commit into
cloudflare:productionfrom
adriandlam:ci/automate-ai-model-catalog-sync
Draft

chore: automate AI model catalog sync#32057
adriandlam wants to merge 1 commit into
cloudflare:productionfrom
adriandlam:ci/automate-ai-model-catalog-sync

Conversation

@adriandlam

@adriandlam adriandlam commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Automates daily synchronization of AI Gateway catalog model files from the Unified Catalog API. The workflow uses cloudflare-docs-bot to open or refresh a pull request when catalog changes are detected, and closes an obsolete catalog pull request when the source matches production again.

The catalog fetcher rejects malformed detail responses and empty catalogs before replacing the existing catalog, omits schema when the API returns null, and reports model-specific failures with a 30-second request timeout.

Required configuration

Configure the AI_MODEL_CATALOG_ACCOUNT_ID and AI_MODEL_CATALOG_API_TOKEN Actions secrets. The workflow reuses the existing cloudflare-docs-bot GitHub App credentials.

Validation

  • pnpm run test:prebuild (116 tests)
  • pnpm run sync
  • pnpm exec eslint bin/fetch-catalog-models.ts
  • pnpm exec prettier --check bin/fetch-catalog-models.ts .github/workflows/sync-ai-model-catalog.yml
  • git diff --check

The live API fetch was not run locally because the catalog API token is only available through Actions secrets.

@adriandlam adriandlam force-pushed the ci/automate-ai-model-catalog-sync branch from 143b631 to 07ff037 Compare July 14, 2026 16:59
@adriandlam adriandlam marked this pull request as ready for review July 14, 2026 17:03
@cloudflare-docs-bot

cloudflare-docs-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review

⚠️ 2 warnings, 💡 1 suggestion found in commit 07ff037.

Fix in your agent
Fix the following review findings in PR #32057 (https://github.com/cloudflare/cloudflare-docs/pull/32057).

Before making changes, review each finding and present a brief summary table:
- For each finding, state whether you agree, disagree, or need clarification
- If you disagree (e.g. the fix requires disproportionate effort for minimal benefit,
  or the finding is factually incorrect), explain why
- If you need clarification before deciding, ask those questions
- Then share your plan for which issues to tackle and in what order

After triaging, fix all legitimate findings. For any you decide to skip,
post a comment on this PR with the finding ID and your reasoning.

---

## Code Review

### Warnings (2)

#### CR-e3e35afb0bb9 · Automated PR falsely attests to style guide compliance
- **File:** `.github/workflows/sync-ai-model-catalog.yml` line 140
- **Issue:** The generated pull request body hard-codes '- [x] The change adheres to the [documentation style guide]...', marking the style-guide checklist as complete even though the bot cannot verify adherence.
- **Fix:** Change the checkbox to unchecked ('- [ ]') so human reviewers actually confirm style-guide compliance before merging.

#### CR-6fdc960868be · Permissive type guard
- **File:** `bin/fetch-catalog-models.ts` line 100
- **Issue:** `isCatalogModel` only validates `model_id`, `name`, `description`, and `metadata`, then casts to the full `CatalogModel` shape. It does not check required fields such as `examples`, `tags`, `task`, `context_length`, or the `private` flag.
- **Fix:** Validate the full required shape in `isCatalogModel`, or validate the JSON output against a schema after writing, so malformed catalog responses cannot silently produce invalid model files.

### Suggestions (1)

#### CR-cd136f5b21f2 · Commit bypasses pre-commit hooks
- **File:** `.github/workflows/sync-ai-model-catalog.yml` line 109
- **Issue:** The commit command uses '--no-verify', which skips the repository's pre-commit hook (prettier/lint-staged and CRLF normalization) for the staged catalog files.
- **Fix:** Remove '--no-verify' unless there is a specific hook that must be skipped, and rely on the earlier validation steps.

Code Review

This code review is in beta and may not always be helpful — use your judgment.

Warnings (2)
File Issue
.github/workflows/sync-ai-model-catalog.yml line 140 Automated PR falsely attests to style guide compliance — The generated pull request body hard-codes '- [x] The change adheres to the [documentation style guide]...', marking the style-guide checklist as complete even though the bot cannot verify adherence. Fix: Change the checkbox to unchecked ('- [ ]') so human reviewers actually confirm style-guide compliance before merging.
bin/fetch-catalog-models.ts line 100 Permissive type guardisCatalogModel only validates model_id, name, description, and metadata, then casts to the full CatalogModel shape. It does not check required fields such as examples, tags, task, context_length, or the private flag. Fix: Validate the full required shape in isCatalogModel, or validate the JSON output against a schema after writing, so malformed catalog responses cannot silently produce invalid model files.
Suggestions (1)
File Issue
.github/workflows/sync-ai-model-catalog.yml line 109 Commit bypasses pre-commit hooks — The commit command uses '--no-verify', which skips the repository's pre-commit hook (prettier/lint-staged and CRLF normalization) for the staged catalog files. Fix: Remove '--no-verify' unless there is a specific hook that must be skipped, and rely on the earlier validation steps.

Conventions

No convention issues found.

Style Guide Review

No style-guide issues found.

Commands

Only codeowners can run commands. Post a comment with the command to trigger it.

Command Description
/review Runs a review now. Incremental if a prior review exists, full if not.
/full-review Re-reviews the entire PR diff from scratch, ignoring incremental history. Useful after a rebase, when you want a fresh review, or if the bot gets out of sync and reports issues that no longer exist.
/ignore-review-limit Permanently lifts the 2-review automatic limit for this PR. Future pushes will trigger reviews as normal.
/disable-auto-review Stops automatic reviews from triggering on future pushes to this PR. Codeowners can still run /review or /full-review manually.

@adriandlam adriandlam changed the title [AI Gateway] Automate model catalog sync chore: automate AI model catalog sync Jul 14, 2026
@adriandlam adriandlam marked this pull request as draft July 14, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.