From 7577834206239485a527448eecc575fee1328a00 Mon Sep 17 00:00:00 2001 From: ethernet Date: Mon, 13 Jul 2026 14:19:39 -0400 Subject: [PATCH] fix(ci): fail closed when workspace matrix discovery produces empty list The set-matrix step wrote the npm workspace query result directly to $GITHUB_OUTPUT. If discovery ever produced [], the matrix would expand to zero check jobs, leaving the reusable workflow green without running any JS/TS checks. Now the step validates the result is a non-empty array before emitting it, and exits 1 with a GitHub annotation if it's empty or jq failed. --- .github/workflows/js-tests.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/js-tests.yml b/.github/workflows/js-tests.yml index 19b8c2b03b15..db08947b270c 100644 --- a/.github/workflows/js-tests.yml +++ b/.github/workflows/js-tests.yml @@ -21,7 +21,12 @@ jobs: command: npm ci --ignore-scripts - id: set-matrix run: | - echo "packages=$(npm query .workspace | jq -c '[.[].location]')" >> "$GITHUB_OUTPUT" + PACKAGES=$(npm query .workspace | jq -c '[.[].location]') + if [ "$PACKAGES" = "[]" ] || [ -z "$PACKAGES" ]; then + echo "::error::Workspace discovery produced an empty package list — refusing to emit a zero-length matrix (would skip all JS/TS checks silently)." + exit 1 + fi + echo "packages=$PACKAGES" >> "$GITHUB_OUTPUT" check: name: Typecheck & Test