From 7ae647d52c7f6037155fa2c7257c854978c32002 Mon Sep 17 00:00:00 2001 From: Chinesezjc Date: Wed, 19 Aug 2026 17:48:32 +0800 Subject: [PATCH] fix(cic): narrow workflow.on before Object.keys in event-set assertion The exact-event-set assertion called Object.keys on a Record's on field without narrowing, failing typecheck (TS2769). Guard with isRecord before asserting the full event sets. --- scripts/ci-workflow.spec.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/ci-workflow.spec.ts b/scripts/ci-workflow.spec.ts index 955afe6af1..721c9987b6 100644 --- a/scripts/ci-workflow.spec.ts +++ b/scripts/ci-workflow.spec.ts @@ -143,6 +143,9 @@ describe('CI workflow', () => { // panel: ci-master triggers only on push(master) + workflow_dispatch and // never on pull_request; ci.yml is exactly pull_request-only. Assert the // full sets so losing the wrong event, or gaining an extra one, fails. + if (!isRecord(workflow.on) || !isRecord(prWorkflow.on)) { + throw new TypeError('both CI workflows must define on') + } expect(Object.keys(workflow.on).sort()).toEqual(['push', 'workflow_dispatch']) expect(Object.keys(prWorkflow.on)).toEqual(['pull_request'])