Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion actions/changeset/check-coverage/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ description: |
- editing files inside a workspace package (e.g. block code under
packages/<pkg>/) 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
Expand Down
14 changes: 12 additions & 2 deletions actions/changeset/check-coverage/check-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
# `"<key>": "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.
#
Expand Down Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions actions/changeset/check-coverage/test/coverage.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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.
# ---------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@check-coverage-test/pkg-dev",
"version": "1.0.0",
"main": "index.js",
"devDependencies": {
"is-string": "catalog:"
}
}
Loading