This repo is the home of the docs piece of the Metabase website for Metabase. Docs are built in a workflow in this repo.
This repo is generated from the Metabase repo. If you have suggestions, please open an issue there, or a PR against the markdown files in Metabase.
This repo contains the docs + docs building mechanisms for Metabase. Docs data
gets pulled from the main metabase repo
and built here automatically when a PR against a publishable branch is updated
or merged. This ends up on metabase.com
because we merge the static assets
(html/css/js) which live here into the marketing
repo during a marketing build.
With these steps in place, at anytime, the master branch of this repo should be publishable alongside the marketing repo site.
Every branch that gets built is also uploaded to cloudflare pages. A link to the live preview will be added to each PR.
Process Docs Changes is triggered
by the
docs_bump_detected.yml,
docs_merge_detected.yml,
and
docs_close_detected.yml
workflows in the main metabase repo. They trigger on PRs targeting master
or a
release branch (release-x.N.x
) with docs changes.
Triggered when the metabase/metabase docs PR is opened or updated. Triggers
process_docs_changes.yml
in the docs.metabase.github.io
repo with the
docs_update
dispatch type. Which will rebuild the docs, and update or open a
PR in the docs repo with the corresponding changes.
Triggered when the metabase/metabase docs PR is merged. Triggers
process_docs_changes.yml
in the docs.metabase.github.io
repo with the
docs_merge
dispatch type. Which merges the {target-branch}->{source-branch}
docs PR.
Triggered when the metabase/metabase docs PR is closed. Triggers
process_docs_changes.yml
in the docs.metabase.github.io
repo with the
docs_merge
dispatch type. Which merges the {target-branch}->{source-branch}
docs PR.
-
Since we've split up the site into 2 jekyll instances, we cannot rely on htmlproofer to check links from the docs to the marketing site. So
script/analyze_links.clj
checks any missing links againstmetabase.com
. -
Copies over control directories from marketing repo. See:script/sync_repo.clj. These are needed to avoid conflicts with the marketing site.
This workflow handles all documentation updates triggered by changes in the main
metabase/metabase
repository, including SDK Docs generation.
It can be nice to run these by-hand, here's where you can trigger it manually: Process Docs Changes.
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
source_branch |
✅ | string | - | The feature/source branch from metabase/metabase that triggered this workflow |
target_branch |
✅ | string | - | The target branch in metabase/metabase (master or release-x.MM.x for backports) |
annotation |
❌ | string | "auto-build" |
comment displayed in the build queue and PR title for data lineage |
dispatch_type |
❌ | choice | "docs_update" |
Action type: docs_update , docs_merge , or docs_close |
pr_number |
❌ | string | - |
adds a link to the docs PR to the original PR in metabase/metabase |
update_dirs |
❌ | string | "" |
comma delimited string of extra dirs to git add during docs_update |
- Use descriptive annotations to identify workflows in the build queue and PR titles
- Keep them concise since they appear in PR titles
- Source branch must match exactly what's in metabase/metabase
- Target branch is typically
master
- Use
release-x.MM.x
format for backports (e.g.,release-x.50.x
) - The source branch must exist in metabase/metabase when running this workflow. If the source branch has been deleted (e.g., after merging the original PR), the workflow will fail. So follow the link to the main repo PR, and restore the branch there.
Solution::
- Restore the branch in metabase/metabase before running the workflow
The workflow maps branches from the main repository to documentation changes:
- Source → Target:
docs-update-naming-55
→master
creates a PR with branchdocs-update-naming-55->master
targetingmaster
in this repo. - Backports:
docs-hotfix-security
→release-x.50.x
creates a PR with branchdocs-hotfix-security->release-0.50.x
targetingmaster
in this repo.
Creates or updates a documentation PR with the naming pattern [annotation] {source-branch}->{target-branch}
. The branchname for the PR will always be
{source-branch}->{target-branch}
.
Example:
In the Metabase repo, someone opens a PR. For example, from a branch called `docs-edit` targeting `master`.
The Metabase PR will trigger the `process_docs_changes` workflow in this repo to create a new PR in this repo called `docs-edit->master` and a corresponding PR for that branch named `[auto-build] docs-edit->master` in this repo.
Merges the existing documentation PR that matches the
{source-branch}->{target-branch}
branchname pattern. Also runs linters as part
of the merge process for safety.
When the metabase/metabase PR is closed, we close the PR in this repo.
These are some nitty gritty details about exactly what happens inside the docs pipeline.
If the target doesn't match master or a release branch, This step stops the build. See util/categorize-branchname for details.
e.g. bb script/check_incoming_branchname.clj --target-branch master
exits 0.
branch | exit-code |
---|---|
master | 0 |
release-x.49.x | 0 |
docs-workflow-test-1 | 0 |
anything-else | 1 |
Makes sure the Cloud docs are only in the latest docs, as the cloud docs aren't versioned.
-
bb script/sync_repo.clj --from-repo .marketing_repo
- Copies control directories from the marketing repo
-
bb script/sync_repo.clj --delete
- Resets this repo's control directories
$ bb script/update_docs_for_branchname.clj --dry-run --target-branch release-x.54.x --source-branch my-branch
┌ Command for release-x.54.x
│ ./script/docs release-x.54.x --set-version v0.54 --source-branch my-branch
└
When the release version number matches the latest docs_version number from the
_config.yml file, automatically sets --latest
as well:
bb script/update_docs_for_branchname.clj --dry-run --source-branch cool-55-docs --target-branch release-x.55.x
┌ Command for release-x.55.x
│ ./script/docs --update --latest --source-branch cool-55-docs
└
Builds ontop of our existing link checking. Since the original jekyll site has
been split into 2, htmlproofer
cannot see links to the marketing site. So this step runs htmlproofer
, and
checks metabase.com
for all "missing links" reported.
This will stop the build when there are htmlproofer-reported links that are not
live on metabase.com
.
Git adds, commits, and creates or updates a PR to master with files associated with the branch. Includes a detailed description in the body of where the PR came from.
bb script/update_or_create_pr.clj \
--source-branch "$MAIN_REPO_SOURCE_BRANCH" \
--target-branch "$MAIN_REPO_TARGET_BRANCH" \
--annotation "$ANNOTATION" \
--pr-number "$PR_NUMBER" \
--update-dirs "$UPDATE_DIRS"
Given the non-trivial scripts run during a build, there are tests for these scripts to ensure they work.
See: script/_test/all.clj.
They are run in the Process Docs Workflow
, and can be run manually via:
bb script/_test/all.clj