From 7b259bd2a488f1311116cc67f71d62406cf5eea2 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 21 Jun 2026 06:16:04 +0200 Subject: [PATCH] test(scripts): route github action metadata --- scripts/test-projects.test-support.mjs | 14 ++++++++++++++ test/scripts/ci-workflow-guards.test.ts | 17 +++++++++++++++++ test/scripts/test-projects.test.ts | 20 ++++++++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/scripts/test-projects.test-support.mjs b/scripts/test-projects.test-support.mjs index f5f93379b9d8..715d15719815 100644 --- a/scripts/test-projects.test-support.mjs +++ b/scripts/test-projects.test-support.mjs @@ -444,6 +444,20 @@ const LIVE_MEDIA_RUNNER_IMAGE_TEST_TARGETS = ["test/scripts/package-acceptance-w const TOOLING_SOURCE_TEST_TARGETS = new Map([ ["Dockerfile", ROOT_DOCKERFILE_TEST_TARGETS], [".crabbox.yaml", ["test/scripts/package-acceptance-workflow.test.ts"]], + [".github/actions/detect-docs-changes/action.yml", ["test/scripts/ci-workflow-guards.test.ts"]], + [ + ".github/actions/docker-e2e-plan/action.yml", + ["test/scripts/package-acceptance-workflow.test.ts"], + ], + [".github/actions/ensure-base-commit/action.yml", ["test/scripts/ci-workflow-guards.test.ts"]], + [ + ".github/actions/setup-node-env/action.yml", + ["test/scripts/package-acceptance-workflow.test.ts"], + ], + [ + ".github/actions/setup-pnpm-store-cache/action.yml", + ["test/scripts/package-acceptance-workflow.test.ts"], + ], [".github/images/live-media-runner/Dockerfile", LIVE_MEDIA_RUNNER_IMAGE_TEST_TARGETS], [".github/workflows/ci.yml", ["test/scripts/ci-workflow-guards.test.ts"]], [ diff --git a/test/scripts/ci-workflow-guards.test.ts b/test/scripts/ci-workflow-guards.test.ts index c330883b86fb..dc7b3193ae41 100644 --- a/test/scripts/ci-workflow-guards.test.ts +++ b/test/scripts/ci-workflow-guards.test.ts @@ -84,6 +84,23 @@ describe("ci workflow guards", () => { expect(findUnpinnedExternalActions()).toEqual([]); }); + it("keeps docs-change detection fail-safe and fixture-aware", () => { + const action = readFileSync(".github/actions/detect-docs-changes/action.yml", "utf8"); + + expect(action).toContain("docs_only:"); + expect(action).toContain("docs_changed:"); + expect(action).toContain('BASE="${{ github.event.before }}"'); + expect(action).toContain('BASE="${{ github.event.pull_request.base.sha }}"'); + expect(action).toContain( + 'CHANGED=$(git diff --name-only "$BASE" HEAD 2>/dev/null || echo "UNKNOWN")', + ); + expect(action).toContain('if [ "$CHANGED" = "UNKNOWN" ] || [ -z "$CHANGED" ]; then'); + expect(action).toContain("docs_only=false"); + expect(action).toContain("docs_changed=false"); + expect(action).toContain("test/fixtures/*)"); + expect(action).toContain("docs/* | *.md | *.mdx)"); + }); + it("runs the session accessor ratchet as a visible additional check", () => { const workflow = readCiWorkflow(); const additionalJob = workflow.jobs["check-additional-shard"]; diff --git a/test/scripts/test-projects.test.ts b/test/scripts/test-projects.test.ts index 7d4a32992221..ff0ff7deef39 100644 --- a/test/scripts/test-projects.test.ts +++ b/test/scripts/test-projects.test.ts @@ -1574,6 +1574,26 @@ describe("scripts/test-projects changed-target routing", () => { ".github/images/live-media-runner/Dockerfile", ["test/scripts/package-acceptance-workflow.test.ts"], ], + [ + ".github/actions/detect-docs-changes/action.yml", + ["test/scripts/ci-workflow-guards.test.ts"], + ], + [ + ".github/actions/docker-e2e-plan/action.yml", + ["test/scripts/package-acceptance-workflow.test.ts"], + ], + [ + ".github/actions/ensure-base-commit/action.yml", + ["test/scripts/ci-workflow-guards.test.ts"], + ], + [ + ".github/actions/setup-node-env/action.yml", + ["test/scripts/package-acceptance-workflow.test.ts"], + ], + [ + ".github/actions/setup-pnpm-store-cache/action.yml", + ["test/scripts/package-acceptance-workflow.test.ts"], + ], [ ".github/workflows/live-media-runner-image.yml", ["test/scripts/package-acceptance-workflow.test.ts"],