ci(models): run metadata check on pull requests

This commit is contained in:
Patrick Wozniak
2026-08-25 14:43:46 +02:00
parent f23863d326
commit 7ed38d5f70
2 changed files with 13 additions and 5 deletions
@@ -1,5 +1,5 @@
import { execFile } from "node:child_process" import { execFile } from "node:child_process"
import { appendFile, mkdtemp, readFile, rm } from "node:fs/promises" import { mkdtemp, readFile, rm } from "node:fs/promises"
import { tmpdir } from "node:os" import { tmpdir } from "node:os"
import { join, resolve } from "node:path" import { join, resolve } from "node:path"
import { pathToFileURL } from "node:url" import { pathToFileURL } from "node:url"
@@ -302,9 +302,6 @@ async function main(): Promise<void> {
console.log(report) console.log(report)
const summaryPath = process.env.GITHUB_STEP_SUMMARY
if (summaryPath) await appendFile(summaryPath, report, "utf-8")
if (hasModelMetadataDiff(diff)) { if (hasModelMetadataDiff(diff)) {
throw new Error( throw new Error(
`Static model metadata differs from command-code@${upstreamPackage.packageVersion}. Update src/models.ts and the snapshot version.`, `Static model metadata differs from command-code@${upstreamPackage.packageVersion}. Update src/models.ts and the snapshot version.`,
+12 -1
View File
@@ -1,6 +1,14 @@
name: Command Code model metadata name: Command Code model metadata
on: on:
pull_request:
branches: [main]
paths:
- ".github/scripts/check-commandcode-model-metadata.ts"
- ".github/workflows/model-metadata.yml"
- "src/core.ts"
- "src/models.ts"
- "tests/test-model-metadata-check.ts"
schedule: schedule:
- cron: "17 6 * * *" - cron: "17 6 * * *"
workflow_dispatch: workflow_dispatch:
@@ -25,4 +33,7 @@ jobs:
registry-url: https://registry.npmjs.org registry-url: https://registry.npmjs.org
- run: npm ci - run: npm ci
- name: Compare static metadata with the latest Command Code CLI - name: Compare static metadata with the latest Command Code CLI
run: npm run check:model-metadata run: npm run check:model-metadata | tee model-metadata-report.md
- name: Publish metadata report
if: always()
run: cat model-metadata-report.md >> "$GITHUB_STEP_SUMMARY"