Skip to main content
The Mintlify multi-repo GitHub Action, mintlify/multirepo-action, copies docs from any number of child repositories into one parent docs repository. It merges each child’s navigation into a single docs.json, so Mintlify deploys the parent like any other single-repository site. Use the action when your docs live in many repositories and you want to manage the list of sources in a config file instead of the dashboard. To combine repositories without copying content, see Multi-repository projects.

How it works

On each run, the action:
  1. Fetches each child repository in parallel, downloading only the folder that contains its docs.
  2. Copies each child’s content into a destination folder in the parent repository. The destination is also the URL path, so a child at api publishes at /api.
  3. Rewrites root-relative links, images, and snippet imports in the child’s .md and .mdx files to include the destination. For example, /guides/start becomes /api/guides/start.
  4. Generates docs.json from a docs.base.json file, with each child’s navigation, variables, and redirects merged in.
  5. Opens or updates a pull request with the changes, or pushes them directly.
If any child fails to fetch or merge, the action fails without changing the parent repository.

Requirements

  • A parent repository on GitHub connected to your Mintlify project
  • A docs.json file with a navigation object in each child repository
  • For private child repositories, a GitHub App installation token or a fine-grained personal access token with contents: read on every child

Set up the action

1

Create a base configuration

In the parent repository, rename docs.json to docs.base.json. The action generates docs.json from this file on every run.Add a sourceRef entry where each child’s navigation should appear. A sourceRef uses the same syntax as multi-repository projects.
docs.base.json
The action replaces each sourceRef with the child’s navigation array of the same kind. For example, a sourceRef inside tabs becomes the child’s navigation.tabs. A sourceRef inside pages becomes the child’s pages, or its groups if it has no pages.Children without a sourceRef are added to the end of the base’s top-level products, tabs, anchors, or dropdowns.
2

List the child repositories

Create .github/mintlify-multirepo.yml in the parent repository.
.github/mintlify-multirepo.yml
The action never copies dotfiles, symlinks, node_modules, or the child’s docs.json. Only the child’s navigation, variables, and redirects are merged. Other settings, like theme and colors, come from docs.base.json.
3

Add the workflow

Create .github/workflows/multirepo.yml in the parent repository. This example runs every hour, on demand, and when a child repository sends a docs-updated event.
.github/workflows/multirepo.yml
If all child repositories are public, remove the create-github-app-token step and the token input.By default, the action opens or updates one pull request with the changes. Merge it to deploy. To let the workflow open pull requests, enable Allow GitHub Actions to create and approve pull requests in the parent repository’s Settings > Actions > General. To push changes directly to the branch instead, set mode: push.
4

Optional: Sync when a child changes

To sync as soon as a child repository changes, add a workflow to each child that notifies the parent. Replace acme/docs with your parent repository. DOCS_DISPATCH_TOKEN needs contents: write access on the parent repository.
.github/workflows/notify-docs.yml

Edit synced content

The action replaces each destination folder and docs.json on every run. Edit content in the child repositories and site settings in docs.base.json. Changes made directly to synced files in the parent repository, including through the web editor, are overwritten on the next sync. When you remove a child from .github/mintlify-multirepo.yml, the action deletes its folder on the next run. Write links in a child repository as if the child were its own site. The action adds the child’s destination to root-relative links, so [Start](/quickstart) in a child with destination: api becomes /api/quickstart. The action doesn’t change links that already point to another child’s destination. For example, [SDK](/sdks/js/install) stays the same when sdks/js is another child’s destination. The action doesn’t rewrite links inside code blocks. For all inputs, outputs, and token options, see the action README.