Skip to content

CI: should-run-ci.sh is blind to depth-2 packages (packages/plugins/*, packages/tools/*) #181

Description

@ilyamore88

Summary

.github/scripts/should-run-ci.sh — the change-detection gate used by every package-check.yml-based workflow to decide whether a package's CI should run on a PR — only resolves depth-1 workspaces under packages/*. It cannot see the depth-2 packages under packages/plugins/* and packages/tools/*, so their dependency-based CI triggering is silently incomplete.

Where

Two spots in the script assume packages/<name>:

  1. Reading a dependency's manifest:

    if [ ! -f "packages/$pkg/package.json" ]; then
      return
    fi

    For a dep like clipboard-plugin / shortcuts-plugin / paragraph, packages/<name>/package.json does not exist (they live at packages/plugins/<name> and packages/tools/<name>), so get_all_deps returns early and never walks their transitive deps.

  2. Mapping a dependency name back to a directory:

    DEP_DIR=$(find packages -maxdepth 1 -type d \( -name "$dep" -o -name "$(echo $dep | sed 's/-/_/g')" \) 2>/dev/null | head -1)

    -maxdepth 1 excludes packages/plugins/* and packages/tools/*, so a changed depth-2 dependency is never matched.

Impact

  • A change to packages/plugins/* or packages/tools/* does not trigger @editorjs/core's CI, even though core depends on those packages — so core is not re-validated against its changed dependencies on that PR.
  • A change to a shared upstream dep (e.g. @editorjs/sdk) does not trigger the depth-2 plugin/tool package CIs via the dependency walk.

Note: a change to the package's own files still triggers its own CI — the first git diff --name-only … -- "$PKG_DIR" check uses the full working-directory input and works fine. Only the dependency fan-out is affected.

This is pre-existing and affects clipboard-plugin, paragraph, bold, italic, inline-link, and now shortcuts-plugin (#171 / #180).

Suggested fix

  • Resolve dependency manifests by searching all workspace roots (packages/*/package.json, packages/plugins/*/package.json, packages/tools/*/package.json) instead of hardcoding packages/$pkg/package.json.
  • Replace find packages -maxdepth 1 with -maxdepth 2 (or enumerate the three known roots) when mapping a dep name to its directory.
  • Ideally derive workspace locations from yarn workspaces list --json so new nesting levels don't reintroduce the bug.

Repro

On a branch that only edits packages/plugins/clipboard-plugin, run:

bash .github/scripts/should-run-ci.sh main ./packages/core --verbose

Expected: core should run (it depends on @editorjs/clipboard-plugin). Actual: exits 1 ("No changes detected"), because the dependency directory is never resolved.

Found while extracting ShortcutsPlugin in #180 (follow-up to #171).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions