diff --git a/actions/changeset/check-coverage/action.yaml b/actions/changeset/check-coverage/action.yaml index 07f97209..8bf83617 100644 --- a/actions/changeset/check-coverage/action.yaml +++ b/actions/changeset/check-coverage/action.yaml @@ -7,7 +7,8 @@ description: | - editing files inside a workspace package (e.g. block code under packages//) without adding that package to the changeset; - bumping a catalog version in pnpm-workspace.yaml without a matching - bump for the workflow packages that consume it via `catalog:`. + bump for packages that consume it as a runtime dependency via + `catalog:` — build-tool bumps in devDependencies are ignored. Runs after `pnpm install`. Requires the runner to have `pnpm`, `jq`, and `yq` (mikefarah, v4+) on PATH — all pre-installed on GitHub-hosted diff --git a/actions/changeset/check-coverage/check-coverage.sh b/actions/changeset/check-coverage/check-coverage.sh index a7ad8311..4fc6d08e 100755 --- a/actions/changeset/check-coverage/check-coverage.sh +++ b/actions/changeset/check-coverage/check-coverage.sh @@ -10,9 +10,17 @@ # git-diff check itself. # # 2. Catalog version bumps in pnpm-workspace.yaml: for each touched -# catalog key, find workspace packages that consume it via +# catalog key, find workspace packages that consume it as a runtime +# dependency (`dependencies` or `peerDependencies`) via # `"": "catalog:..."` and require those packages to bump. # +# Runtime sections only — skip devDependencies and optionalDependencies. +# A build-tool bump (e.g. @platforma-sdk/block-tools in a block's model, +# @platforma-sdk/tengo-builder in its workflow) leaves the published +# artifact unchanged, and `pnpm changeset` ignores it too. Counting it +# flagged packages the PR never touched — e.g. a UI-only change that +# carried a shared build-tool bump. +# # Skips private (unpublished) workspace packages — they never appear in # the changeset's release set. # @@ -186,8 +194,10 @@ if git diff --name-only "origin/${BASE_BRANCH}...HEAD" | grep -qx 'pnpm-workspac [ "${pkg_is_private[${name}]:-false}" = 'true' ] && continue pj="${pkg_name_to_dir[${name}]}/package.json" [ -f "${pj}" ] || continue + # Runtime sections only — a build-tool bump in devDependencies leaves + # the published artifact unchanged (see the header note). if jq -e --arg k "${key}" ' - [.dependencies?, .devDependencies?, .peerDependencies?, .optionalDependencies?] + [.dependencies?, .peerDependencies?] | map(select(. != null) | to_entries) | add // [] | map(select(.key == $k and ((.value // "") | startswith("catalog:")))) | length > 0 diff --git a/actions/changeset/check-coverage/test/coverage.bats b/actions/changeset/check-coverage/test/coverage.bats index 369a6d98..8c891049 100644 --- a/actions/changeset/check-coverage/test/coverage.bats +++ b/actions/changeset/check-coverage/test/coverage.bats @@ -116,6 +116,19 @@ setup() { [ "${status}" -eq 0 ] } +@test "catalog bump consumed only as a devDependency does not flag the consumer" { + # is-string is a runtime dep of pkg-c but only a devDependency of pkg-dev. + # Bumping it flags pkg-c and leaves pkg-dev alone — the block case where a + # build-tool catalog dep (block-tools, tengo-builder) bumps while the + # package stays untouched. Runtime-only scoping fixed this; pkg-dev was + # flagged before. + bump_catalog 'is-string' '^1.0.8' + run_check + [ "${status}" -eq 1 ] + [[ "${output}" == *'@check-coverage-test/pkg-c'* ]] + [[ "${output}" != *'@check-coverage-test/pkg-dev'* ]] +} + # --------------------------------------------------------------------------- # Empty-changeset corner case. # --------------------------------------------------------------------------- diff --git a/actions/changeset/check-coverage/test/fixtures/minimal-workspace/packages/pkg-dev/index.js b/actions/changeset/check-coverage/test/fixtures/minimal-workspace/packages/pkg-dev/index.js new file mode 100644 index 00000000..08200410 --- /dev/null +++ b/actions/changeset/check-coverage/test/fixtures/minimal-workspace/packages/pkg-dev/index.js @@ -0,0 +1,3 @@ +// Consumes is-string only as a devDependency (a build-tool stand-in), so a +// catalog bump for is-string leaves this package out of the required set. +module.exports = {}; diff --git a/actions/changeset/check-coverage/test/fixtures/minimal-workspace/packages/pkg-dev/package.json b/actions/changeset/check-coverage/test/fixtures/minimal-workspace/packages/pkg-dev/package.json new file mode 100644 index 00000000..ab988896 --- /dev/null +++ b/actions/changeset/check-coverage/test/fixtures/minimal-workspace/packages/pkg-dev/package.json @@ -0,0 +1,8 @@ +{ + "name": "@check-coverage-test/pkg-dev", + "version": "1.0.0", + "main": "index.js", + "devDependencies": { + "is-string": "catalog:" + } +}