Monorepo – test package then test integration with all packages

Suppose I have a monorepo (npm workspace):


Currently each monorepo package has their own workflow file:


Suppose running the banana tests is very slow.

Currently I’ve set it up so it only runs the apple tests when you change something in apple:

      - 'packages/apple/*'
      - '.github/workflows/apple.yml'

And likewise for banana and carrot.

Problem is, I want to run all the tests, but only if the changed package’s tests pass first. I want to ensure the package’s own tests work before running slow integration tests.

i.e. If I only update apple I want to first run the apple tests, and only once they pass will the (slow) tests for banana and carrot run.

Any recommendations on a good way to set this up?
Seems like I need dependent workflows or something?