Directory chaining and repository dependencies for PR previews

Hi Netlify Community! :wave:

I am new to the community and would like to start this thread to get input and ideas on a potential usage of netlify; would like to hear from the community on different ideas with regards to dealing with multiple repositories and submodules.

I would like to know if it is architecturally possible to create repository dependencies with netlify .What I mean by that is want PR preview builds for one repo built based on a PR on another repo. So for example here is a usecase that I have:

  • Repo A contains the main site connected to netlify (built and hosted)
  • The site is composed of different tutorials and each tutorial is stored in Repo B (which is a submodule of Repo A)
    *Repo A is a private repo and Repo B is a public one (tutorials are authored by members of the open source community)
  • Netlify is configured on Repo A to build and host the main website

I would like to eventually connect Repo B to netlify in a way such that

  • When a new tutorial is created (a PR on Repo B) I would like netlify to build Repo A and have a preview link on Repo B for the main site
  • When a PR is merged in Repo B, the submodule in Repo A will be automatically updated with the latest Repo B codebase (which I believe can be achieved with github actions and this will take care of building and hosting the production site since Repo A is already connected to netlify)

The way I am currently doing this is by manually triggering a netlify preview link whenever a PR is up on Repo B. I do this by

  1. Manually pulling that PR from the submodule in Repo A
  2. Create a PR on Repo A with this submodule change
  3. Copy the link to the staging preview from Repo A to the PR on Repo B

Not sure if this was discussed before, I tried searching online and on the community for a similar use case but was not able to find any.

Thanks!