diff --git a/.github/scripts/check-commandcode-model-metadata.ts b/.github/scripts/check-commandcode-model-metadata.ts index 7182cc5..bfc72ab 100644 --- a/.github/scripts/check-commandcode-model-metadata.ts +++ b/.github/scripts/check-commandcode-model-metadata.ts @@ -1,5 +1,5 @@ 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 { join, resolve } from "node:path" import { pathToFileURL } from "node:url" @@ -302,9 +302,6 @@ async function main(): Promise { console.log(report) - const summaryPath = process.env.GITHUB_STEP_SUMMARY - if (summaryPath) await appendFile(summaryPath, report, "utf-8") - if (hasModelMetadataDiff(diff)) { throw new Error( `Static model metadata differs from command-code@${upstreamPackage.packageVersion}. Update src/models.ts and the snapshot version.`, diff --git a/.github/workflows/model-metadata.yml b/.github/workflows/model-metadata.yml index c933905..809eef8 100644 --- a/.github/workflows/model-metadata.yml +++ b/.github/workflows/model-metadata.yml @@ -1,6 +1,14 @@ name: Command Code model metadata 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: - cron: "17 6 * * *" workflow_dispatch: @@ -25,4 +33,7 @@ jobs: registry-url: https://registry.npmjs.org - run: npm ci - 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"